ExcessibilityStorybook.Tokens (excessibility_storybook v0.1.0)

Copy Markdown View Source

Reads --color-* custom properties out of a stylesheet, grouped by the block that declares them (a daisyUI theme, :root, @theme, [data-theme=x], ...).

This is a scan of innermost {} blocks, not a CSS parser. var(--x) is followed through any custom property declared in the file (the last declaration wins, whatever its selector), then its fallback. Values that still aren't a literal color (e.g. color-mix(...)) are listed in skipped.

Summary

Functions

parse(css)

@spec parse(String.t()) :: [
  %{name: String.t(), tokens: [map()], skipped: [{String.t(), String.t()}]}
]

read!(path)

@spec read!(Path.t()) :: [map()]