AshUi.Theme.VSCode (ash_ui v0.1.0)

Copy Markdown View Source

Build-side stylesheet GENERATOR for VS Code color-theme JSON (DESIGN.md §9).

Theme JSON goes in, CSS text comes out: VS Code webview-compatible custom properties (--vscode-*), a small [part=...] mapping for VS Code-style lists, side bars, panels and inputs, and TextMate scope CSS. WCAG contrast gates apply at generation time.

This module does not participate in rendering. Write the generated CSS to a file BEFORE the resources declaring it compile, then declare it like any stylesheet:

css = AshUi.Theme.VSCode.stylesheet_from_file!("priv/themes/dark.json")
File.write!("assets/css/theme.css", css)

ash_ui do
  stylesheets ["assets/css/theme.css", "assets/css/app.css"]
end

Summary

Functions

Loads VS Code theme JSON from path, verifies WCAG contrast, and returns the generated stylesheet TEXT. The caller writes it to a file and declares that file in stylesheets.

Functions

contrast_errors(json, opts \\ [])

@spec contrast_errors(map(), keyword()) :: [String.t()]

load_file!(path)

@spec load_file!(Path.t()) :: map()

stylesheet!(json, opts \\ [])

@spec stylesheet!(map(), keyword()) :: String.t()

stylesheet_from_file!(path, opts \\ [])

@spec stylesheet_from_file!(Path.t(), keyword()) :: String.t()

Loads VS Code theme JSON from path, verifies WCAG contrast, and returns the generated stylesheet TEXT. The caller writes it to a file and declares that file in stylesheets.

verify_contrast!(json, opts \\ [])

@spec verify_contrast!(map(), keyword()) :: :ok