(ns frq.theme "COSMIC's design tokens, as Flutter values. The colours, radii and spacing are the user's own, read out of cosmic-config by tools/cosmic2cljd.py into `frq.theme.cosmic` — so the phone is painted in whatever accent and surfaces COSMIC Settings is set to, rather than in a guess at what COSMIC looks like. `just theme` moves them. What is not in cosmic-config is the typography scale: libcosmic carries title1..title4, heading, body and caption as code rather than as configuration. Those numbers are here, and the mapping from glimmer's tags to them is `crates/jolt-cosmic`'s — `:title` is title3, `:title-2` is title4, `:label` is body, `:dim-label` is caption." (:require ["package:flutter/material.dart" :as m] [frq.theme.cosmic :as c])) ;; ------------------------------------------------------------------ scale (def space-xxxs c/space-xxxs) (def space-xxs c/space-xxs) (def space-xs c/space-xs) (def space-s c/space-s) (def space-m c/space-m) (def radius-xs c/radius-xs) (def radius-s c/radius-s) (def radius-m c/radius-m) ;; libcosmic's typography, which is code rather than config. (def text-title-3 24.0) ; :title (def text-title-4 20.0) ; :title-2 (def text-body 14.0) ; :label (def text-caption 12.0) ; :dim-label, :status, :spinner ;; ---------------------------------------------------------------- palette (def accent c/accent) (def on-accent c/on-accent) (def bg c/bg) (def on-bg c/on-bg) (def component c/component) (def component-hover c/component-hover) (def card c/card) (def card-component c/card-component) (def on-card c/on-card) (def destructive c/destructive) (def on-destructive c/on-destructive) (def success c/success) (def divider c/divider) (def dim "`:dim-label` is libcosmic's caption class, which is the body colour stepped back rather than a colour of its own." (.withValues ^m/Color on-bg .alpha 0.7)) (def brightness (if c/dark? m/Brightness.dark m/Brightness.light)) (defn app-theme [] (m/ThemeData .useMaterial3 true .brightness brightness .scaffoldBackgroundColor bg .canvasColor bg .colorScheme (m/ColorScheme.fromSeed .seedColor accent .brightness brightness .surface bg .primary accent .onPrimary on-accent) ;; COSMIC's own UI font. Absent on Android, where the fallback is Roboto — ;; a difference the tokens cannot fix and the only one that shows. .fontFamily "Fira Sans"))