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)
23withAlpha ∷ Number -> Color -> Color
24withAlpha alpha c1 = Color.rgba' r g b alpha
26 { r, g, b } = Color.toRGBA' c1
28unsafeWithAlpha ∷ Number -> String -> String
29unsafeWithAlpha alpha s1 =
31 c1 <- Color.fromHexString s1
33 { r, g, b } = Color.toRGBA' c1
34 pure $ Color.cssStringRGBA (Color.rgba' r g b alpha)
36unsafeAlaColor ∷ (Color -> Color) -> String -> String
38 fromMaybe "hotpink" do
39 c1 <- Color.fromHexString s1
40 pure $ Color.toHexString (fn c1)
42f ∷ ∀ fieldName. SProxy fieldName
45fromTheme ∷ Theme -> CSSTheme
48 ( {- background -} RB.insert (f ∷ _ "backgroundColourLighter")
49 (theme.backgroundColour # lighter)
50 >>> RB.insert (f ∷ _ "backgroundColourLightest")
51 (theme.backgroundColour # lighter # lighter)
52 >>> RB.insert (f ∷ _ "backgroundColourDarker")
53 (theme.backgroundColour # darker)
54 >>> RB.insert (f ∷ _ "backgroundColourDarkest")
55 (theme.backgroundColour # darker # darker)
56 >>> RB.insert (f ∷ _ "interfaceColourLighter")
57 (theme.interfaceColour # lighter)
58 >>> RB.insert (f ∷ _ "interfaceColourLightest")
59 (theme.interfaceColour # lighter >>> lighter)
60 >>> RB.insert (f ∷ _ "interfaceColourDarker")
61 (theme.interfaceColour # darker)
62 >>> RB.insert (f ∷ _ "interfaceColourDarkest")
63 (theme.interfaceColour # darker >>> darker)
66 >>> RB.insert (f ∷ _ "textColourLighter")
67 (theme.textColour # lighter)
68 >>> RB.insert (f ∷ _ "textColourLightest")
69 (theme.textColour # lighter >>> lighter)
70 >>> RB.insert (f ∷ _ "textColourDarker")
71 (theme.textColour # darker)
72 >>> RB.insert (f ∷ _ "textColourDarkest")
73 (theme.textColour # darker >>> darker)
76 >>> RB.insert (f ∷ _ "highlightColourDark")
77 (theme.highlightColour # darken 0.2 # rotateHue (-10.0))
78 >>> RB.insert (f ∷ _ "highlightColourRotatedForwards")
79 (theme.highlightColour # rotateHue (20.0))
80 >>> RB.insert (f ∷ _ "highlightColourRotatedBackwards")
81 (theme.highlightColour # rotateHue (-20.0))
84 >>> RB.insert (f ∷ _ "altHighlightColourDark")
85 (theme.altHighlightColour # darken 0.2)
88 >>> RB.modify (f ∷ _ "textFontFamily") (intercalate ",")
89 >>> RB.modify (f ∷ _ "headingFontFamily") (intercalate ",")
90 >>> RB.modify (f ∷ _ "codeFontFamily") (intercalate ",")
91 >>> RB.insert (f ∷ _ "isLight") isLightTheme
92 >>> RB.insert (f ∷ _ "fontWeightBold") "300"
96 isLightTheme = isLight theme.backgroundColour
97 lighter ∷ Color -> Color
98 lighter = if isLightTheme then lighten 0.04 else lighten 0.02
99 darker ∷ Color -> Color
100 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