-module(sparklinekit@theme). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/sparklinekit/theme.gleam"). -export([ocean/0, forest/0, sunset/0, mono/0, neon/0, pastel/0, crimson/0, slate/0, amber/0, midnight/0, default/0, foreground/1, background/1, area/1, negative/1]). -export_type([theme/0]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. ?MODULEDOC( " Named colour schemes for the SVG and PNG renderers.\n" "\n" " ```gleam\n" " import sparklinekit/line\n" " import sparklinekit/theme\n" "\n" " pub fn ocean_chart() -> String {\n" " line.new([1.0, 5.0, 3.0, 8.0, 4.0])\n" " |> line.with_theme(theme.ocean())\n" " |> line.with_area_fill(True)\n" " |> line.to_svg\n" " }\n" " ```\n" "\n" " Each theme is a small bundle of four CSS colour strings:\n" "\n" " - `foreground` — the stroke or main fill colour.\n" " - `background` — the colour for the chart's background rectangle.\n" " - `area` — the fill colour used under the line when\n" " `with_area_fill(True)` is set.\n" " - `negative` — the colour used for negative bars in `bar`\n" " charts; line charts ignore it.\n" "\n" " Pass a theme to `line.with_theme` / `bar.with_theme` to set all\n" " four slots at once. The individual `with_color`,\n" " `with_background_color`, `with_area_color`, and\n" " `with_negative_color` helpers override one slot at a time and can\n" " be chained after `with_theme` to tweak it.\n" ). -opaque theme() :: {theme, binary(), binary(), binary(), binary()}. -file("src/sparklinekit/theme.gleam", 40). ?DOC( " Classic vivid blue on white — a sensible default for product\n" " dashboards. Foreground is Tailwind `blue-600`.\n" ). -spec ocean() -> theme(). ocean() -> {theme, <<"#2563EB"/utf8>>, <<"#FFFFFF"/utf8>>, <<"#2563EB33"/utf8>>, <<"#94A3B8"/utf8>>}. -file("src/sparklinekit/theme.gleam", 51). ?DOC( " Emerald green paired with a red negative — the canonical\n" " \"finance up / down\" palette.\n" ). -spec forest() -> theme(). forest() -> {theme, <<"#10B981"/utf8>>, <<"#FFFFFF"/utf8>>, <<"#10B98133"/utf8>>, <<"#EF4444"/utf8>>}. -file("src/sparklinekit/theme.gleam", 61). ?DOC(" Warm orange — good for attention or \"trending\" indicators.\n"). -spec sunset() -> theme(). sunset() -> {theme, <<"#F97316"/utf8>>, <<"#FFFFFF"/utf8>>, <<"#F9731633"/utf8>>, <<"#7C3AED"/utf8>>}. -file("src/sparklinekit/theme.gleam", 72). ?DOC( " Near-black on pure white — print-friendly and embeds cleanly in\n" " monochrome dashboards.\n" ). -spec mono() -> theme(). mono() -> {theme, <<"#0F172A"/utf8>>, <<"#FFFFFF"/utf8>>, <<"#0F172A29"/utf8>>, <<"#94A3B8"/utf8>>}. -file("src/sparklinekit/theme.gleam", 82). ?DOC(" High-contrast cyan on near-black — designed for dark UIs.\n"). -spec neon() -> theme(). neon() -> {theme, <<"#22D3EE"/utf8>>, <<"#020617"/utf8>>, <<"#22D3EE33"/utf8>>, <<"#F472B6"/utf8>>}. -file("src/sparklinekit/theme.gleam", 92). ?DOC(" Soft violet on a paper-white canvas — low-key, design-focused.\n"). -spec pastel() -> theme(). pastel() -> {theme, <<"#A78BFA"/utf8>>, <<"#FAF5FF"/utf8>>, <<"#A78BFA33"/utf8>>, <<"#FB7185"/utf8>>}. -file("src/sparklinekit/theme.gleam", 103). ?DOC( " Saturated red on white — useful for losses, alerts, or\n" " \"attention required\" KPIs.\n" ). -spec crimson() -> theme(). crimson() -> {theme, <<"#DC2626"/utf8>>, <<"#FFFFFF"/utf8>>, <<"#DC262633"/utf8>>, <<"#94A3B8"/utf8>>}. -file("src/sparklinekit/theme.gleam", 114). ?DOC( " Neutral slate grey on white — corporate, low-saturation, works\n" " alongside any brand colour without competing with it.\n" ). -spec slate() -> theme(). slate() -> {theme, <<"#475569"/utf8>>, <<"#FFFFFF"/utf8>>, <<"#47556933"/utf8>>, <<"#F59E0B"/utf8>>}. -file("src/sparklinekit/theme.gleam", 125). ?DOC( " Golden amber on white — popular for finance and \"warning\"\n" " indicators where red would be too strong.\n" ). -spec amber() -> theme(). amber() -> {theme, <<"#F59E0B"/utf8>>, <<"#FFFFFF"/utf8>>, <<"#F59E0B33"/utf8>>, <<"#DC2626"/utf8>>}. -file("src/sparklinekit/theme.gleam", 136). ?DOC( " Off-white foreground on deep navy — a dark-mode companion to\n" " `mono()`, for embedding into dark dashboards.\n" ). -spec midnight() -> theme(). midnight() -> {theme, <<"#F8FAFC"/utf8>>, <<"#020617"/utf8>>, <<"#F8FAFC29"/utf8>>, <<"#FB7185"/utf8>>}. -file("src/sparklinekit/theme.gleam", 148). ?DOC( " Default theme used when no `with_theme` call is made: CSS\n" " `currentColor` for the foreground, no background fill, an\n" " auto-derived area tint, and a fallback negative bar colour.\n" ). -spec default() -> theme(). default() -> {theme, <<"currentColor"/utf8>>, <<"none"/utf8>>, <<"currentColor"/utf8>>, <<"#EF4444"/utf8>>}. -file("src/sparklinekit/theme.gleam", 158). ?DOC(" The chart's main stroke / fill colour.\n"). -spec foreground(theme()) -> binary(). foreground(Theme) -> erlang:element(2, Theme). -file("src/sparklinekit/theme.gleam", 165). ?DOC( " Background rectangle colour. The string `\"none\"` disables the\n" " background rectangle entirely (the renderer omits it from the\n" " SVG / leaves PNG pixels transparent).\n" ). -spec background(theme()) -> binary(). background(Theme) -> erlang:element(3, Theme). -file("src/sparklinekit/theme.gleam", 171). ?DOC( " Area-fill colour used under the line in `line` charts when\n" " `with_area_fill(True)` is set.\n" ). -spec area(theme()) -> binary(). area(Theme) -> erlang:element(4, Theme). -file("src/sparklinekit/theme.gleam", 177). ?DOC( " Colour applied to negative bars in `bar` charts. Ignored by\n" " `line` charts.\n" ). -spec negative(theme()) -> binary(). negative(Theme) -> erlang:element(5, Theme).