1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-27 02:54:51 +09:00

UI: Add settings option to change main UI color

This commit is contained in:
fr33domlover 2022-09-28 06:03:43 +00:00
parent b1590ad44d
commit 0d1de1278b
4 changed files with 25 additions and 4 deletions

View file

@ -171,3 +171,9 @@ retry-delivery-every:
# documents. The available styles are listed in the "Text.Pandoc.Highlighting"
# module documentation.
highlight-style: zenburn
# Color scheme to use for UI header, footer, links on pages etc., should help
# with visually identifying instances that may otherwise look very much alike.
# Any number is valid; the scheme is chosen via modulo the number of available
# schemes.
main-color: 0

View file

@ -275,6 +275,15 @@ instance Yesod App where
instanceHost = appInstanceHost settings
federationDisabled = not $ appFederation settings
federatedServers = appInstances settings
main =
case appMainColor settings `mod` 6 of
0 -> blue
1 -> green
2 -> red
3 -> yellow
4 -> magenta
5 -> cyan
_ -> error "Impossible mod 6"
$(widgetFile "default-layout")
withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet")
where

View file

@ -194,6 +194,11 @@ data AppSettings = AppSettings
-- | Default color scheme for syntax highlighting of code blocks inside
-- documentes rendered with pandoc.
, appHighlightStyle :: Text
-- | COlor scheme to use for UI header, footer, links on pages etc.,
-- should help with visually identifying instances that may otherwise
-- look very much alike. Any number is valid; the scheme is chosen via
-- modulo the number of available schemes.
, appMainColor :: Int
}
instance FromJSON AppSettings where
@ -253,6 +258,7 @@ instance FromJSON AppSettings where
case lookup s highlightingStyles of
Nothing -> fail $ "Highlighting style " ++ s ++ " not found"
Just _ -> return $ T.pack s
appMainColor <- o .:? "main-color" .!= 0
return AppSettings {..}
where

View file

@ -27,13 +27,13 @@ body
header
padding: 1.2rem 1.8rem
margin: 0 0 3rem
background-color: #{dark blue}
background-color: #{dark main}
footer
margin-top: 3rem
padding: 1.4rem 1.8rem
font-size: 1.4rem
background-color: #{dark blue}
background-color: #{dark main}
line-height: 1.5
footer a
@ -54,7 +54,7 @@ ul
line-height: 1.3
a
color: #{light blue}
color: #{light main}
text-decoration: none
a:hover
@ -111,7 +111,7 @@ input:hover[type="submit"]
background: #{dark gray}
.instance
color: #{light blue}
color: #{light main}
font: 180% monospace
.username