arcoNamedColorAt function

Color? arcoNamedColorAt(
  1. String name,
  2. int index,
  3. Brightness brightness
)

取具名色在指定明暗模式下的第 index(1-10)阶颜色。

对应官方 CSS 变量 --{name}-{index}:暗色主题下这些变量会被整块重定义, 因此这里同样按 brightness 选择色板中的亮色或暗色分支, 而不是对亮色阶做透明度叠加(*-light-* 语义色才走后者)。

Implementation

Color? arcoNamedColorAt(String name, int index, Brightness brightness) {
  final ArcoPalette? palette = arcoPaletteOf(name);
  if (palette == null) {
    return null;
  }
  return brightness == Brightness.dark
      ? palette.darkAt(index)
      : palette.lightAt(index);
}