diff --git a/config/settings-default.yaml b/config/settings-default.yaml index 4255e6c..ddc2bd9 100644 --- a/config/settings-default.yaml +++ b/config/settings-default.yaml @@ -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 diff --git a/src/Vervis/Foundation.hs b/src/Vervis/Foundation.hs index 2d2d18a..f31d0aa 100644 --- a/src/Vervis/Foundation.hs +++ b/src/Vervis/Foundation.hs @@ -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 diff --git a/src/Vervis/Settings.hs b/src/Vervis/Settings.hs index bfec872..b3e2ae1 100644 --- a/src/Vervis/Settings.hs +++ b/src/Vervis/Settings.hs @@ -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 diff --git a/templates/default-layout.cassius b/templates/default-layout.cassius index 17a18b9..f05e9b4 100644 --- a/templates/default-layout.cassius +++ b/templates/default-layout.cassius @@ -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