Skip to main content
Module

x/fresh/plugins/twindv1_deps.ts>DarkColor

The next-gen web framework.
Extremely Popular
Latest
type alias DarkColor
import { type DarkColor } from "https://deno.land/x/fresh@1.6.8/plugins/twindv1_deps.ts";

Allows to return a dark color for the given light color.

{
  // 50 -> 900, 100 -> 800, ..., 800 -> 100, 900 -> 50
  darkColor: autoDarkColor
  // custom resolvers
  darkColor: (section, key, { theme }) => theme(`${section}.${key}-dark`) as ColorValue
  darkColor: (section, key, { theme }) => theme(`dark.${section}.${key}`) as ColorValue
  darkColor: (section, key, { theme }) => theme(`${section}.dark.${key}`) as ColorValue
  darkColor: (section, key, context, lightColor) => generateDarkColor(lightColor),
}

Or use the light color to generate a dark color

{
  darkColor: (section, key, context, color) => generateDark(color)
}
definition: (
section: string,
key: string,
context: Context<Theme>,
color: ColorValue,
) => ColorValue | Falsey