ExcelColor.theme constructor

ExcelColor.theme(
  1. ThemeColor color, {
  2. double tint = 0.0,
})

A document-theme color reference (e.g. accent1). Unlike a literal color it stays linked to the workbook's theme, so it follows the file's color scheme in Excel/Sheets and shifts if the theme changes.

tint (clamped to -1.0..1.0) lightens (positive) or darkens (negative) the base theme color, matching Excel's lighter/darker shade variants. colorHex/colorInt resolve against the standard Office palette so the color still has a usable literal value before the file is opened.

Written as <color theme="N" tint="X"/>.

Implementation

factory ExcelColor.theme(ThemeColor color, {double tint = 0.0}) {
  final t = tint.clamp(-1.0, 1.0);
  return ExcelColor._ref(
    _resolveDefaultThemeColor(color.index, t),
    themeIndex: color.index,
    tint: t,
  );
}