4import CSS (contrast, darken, isLight, lighten, rotateHue)
7import Data.Foldable (intercalate)
8import Data.Maybe (fromMaybe)
9import Data.Symbol (SProxy(..))
10import Record.Builder as RB
11import Yoga.Theme.Types (Theme, CSSTheme)
13increaseContrast ∷ Color -> Color -> Color
14increaseContrast contrastWith = go 0
16 modify = if isLight contrastWith then darken else lighten
18 if contrast contrastWith col >= 7.5 || i >= 20 then
21 go (i + 1) (modify 0.1 col)
23unsafeWithAlpha ∷ Number -> String -> String
24unsafeWithAlpha alpha s1 =
26 c1 <- Color.fromHexString s1
28 { r, g, b } = Color.toRGBA' c1
29 pure $ Color.cssStringRGBA (Color.rgba' r g b alpha)
31unsafeAlaColor ∷ (Color -> Color) -> String -> String
33 fromMaybe "hotpink" do
34 c1 <- Color.fromHexString s1
35 pure $ Color.toHexString (fn c1)
37f ∷ ∀ fieldName. SProxy fieldName
40fromTheme ∷ Theme -> CSSTheme
43 ( {- background -} RB.insert (f ∷ _ "backgroundColourLighter")
44 (theme.backgroundColour # lighter)
45 >>> RB.insert (f ∷ _ "backgroundColourLightest")
46 (theme.backgroundColour # lighter # lighter)
47 >>> RB.insert (f ∷ _ "backgroundColourDarker")
48 (theme.backgroundColour # darker)
49 >>> RB.insert (f ∷ _ "backgroundColourDarkest")
50 (theme.backgroundColour # darker # darker)
51 >>> RB.insert (f ∷ _ "interfaceColourLighter")
52 (theme.interfaceColour # lighter)
53 >>> RB.insert (f ∷ _ "interfaceColourLightest")
54 (theme.interfaceColour # lighter >>> lighter)
55 >>> RB.insert (f ∷ _ "interfaceColourDarker")
56 (theme.interfaceColour # darker)
57 >>> RB.insert (f ∷ _ "interfaceColourDarkest")
58 (theme.interfaceColour # darker >>> darker)
61 >>> RB.insert (f ∷ _ "textColourLighter")
62 (theme.textColour # lighter)
63 >>> RB.insert (f ∷ _ "textColourLightest")
64 (theme.textColour # lighter >>> lighter)
65 >>> RB.insert (f ∷ _ "textColourDarker")
66 (theme.textColour # darker)
67 >>> RB.insert (f ∷ _ "textColourDarkest")
68 (theme.textColour # darker >>> darker)
71 >>> RB.insert (f ∷ _ "highlightColourDark")
72 (theme.highlightColour # darken 0.2 # rotateHue (-10.0))
73 >>> RB.insert (f ∷ _ "highlightColourRotatedForwards")
74 (theme.highlightColour # rotateHue (20.0))
75 >>> RB.insert (f ∷ _ "highlightColourRotatedBackwards")
76 (theme.highlightColour # rotateHue (-20.0))
79 >>> RB.insert (f ∷ _ "altHighlightColourDark")
80 (theme.altHighlightColour # darken 0.2)
83 >>> RB.modify (f ∷ _ "textFontFamily") (intercalate ",")
84 >>> RB.modify (f ∷ _ "headingFontFamily") (intercalate ",")
85 >>> RB.modify (f ∷ _ "codeFontFamily") (intercalate ",")
86 >>> RB.insert (f ∷ _ "isLight") isLightTheme
87 >>> RB.insert (f ∷ _ "fontWeightBold") "300"
91 isLightTheme = isLight theme.backgroundColour
92 lighter ∷ Color -> Color
93 lighter = if isLightTheme then lighten 0.04 else lighten 0.02
94 darker ∷ Color -> Color
95 darker = if isLightTheme then darken 0.01 else darken 0.01
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list