build method

List<StyleRule> build()

Implementation

List<StyleRule> build() {
  final colors = {for (final color in this) '--${color.name}': color};

  final light = {for (final entry in colors.entries) entry.key: entry.value.light.value};

  final dark = {
    for (final entry in colors.entries)
      if (entry.value case ThemeColor(:final dark?)) entry.key: dark.value,
  };

  return [css(':root').styles(raw: light), if (dark.isNotEmpty) css(':root[data-theme="dark"]').styles(raw: dark)];
}