rcfiles/.config/termonad/termonad.hs

154 lines
4.9 KiB
Haskell
Raw Normal View History

2018-12-04 23:11:41 +00:00
{-# LANGUAGE OverloadedStrings #-}
2020-10-29 13:00:10 +00:00
-- | This is my Termonad configuration.
2021-05-28 06:18:47 +00:00
-- Currently defaults to PaperColor
2018-12-04 23:11:41 +00:00
module Main where
2020-10-29 13:00:10 +00:00
import Data.Maybe (fromMaybe)
2018-12-06 02:37:02 +00:00
import Termonad
2020-05-23 08:35:58 +00:00
( CursorBlinkMode(CursorBlinkModeOn)
, Option(Set)
, ShowScrollbar(ShowScrollbarNever)
, TMConfig
, confirmExit
, cursorBlinkMode
, defaultConfigOptions
, defaultTMConfig
, options
, showMenu
, showScrollbar
, start
, FontConfig
, FontSize(FontSizePoints)
, defaultFontConfig
, fontConfig
, fontFamily
, fontSize
2018-12-04 23:11:41 +00:00
)
import Termonad.Config.Colour
( AlphaColour
, ColourConfig
, Palette(ExtendedPalette)
, addColourExtension
, createColour
, createColourExtension
, defaultColourConfig
2020-10-29 13:00:10 +00:00
, defaultStandardColours
, defaultLightColours
2020-01-25 14:18:18 +00:00
, backgroundColour
, foregroundColour
, palette
2020-10-29 13:00:10 +00:00
, List8
, mkList8
2018-12-06 02:37:02 +00:00
)
2018-12-04 23:11:41 +00:00
2018-12-06 02:37:02 +00:00
-- This is our main 'TMConfig'. It holds all of the non-colour settings
-- for Termonad.
2018-12-04 23:11:41 +00:00
--
2018-12-06 02:37:02 +00:00
-- This shows how a few settings can be changed.
myTMConfig :: TMConfig
myTMConfig =
defaultTMConfig
{ options =
defaultConfigOptions
{ showScrollbar = ShowScrollbarNever
, confirmExit = False
, showMenu = False
2020-05-23 08:35:58 +00:00
, cursorBlinkMode = CursorBlinkModeOn
2018-12-06 02:37:02 +00:00
, fontConfig = fontConf
}
}
2018-12-04 23:11:41 +00:00
2021-05-28 06:18:47 +00:00
-- This is our PaperColor dark 'ColourConfig'. It holds all of our dark-related settings.
paperColorDark :: ColourConfig (AlphaColour Double)
paperColorDark =
2020-10-29 13:00:10 +00:00
defaultColourConfig
2021-05-28 06:18:47 +00:00
-- Set the default background & foreground colour of text of the terminal.
{ backgroundColour = Set (createColour 28 28 28) -- black.0
, foregroundColour = Set (createColour 208 208 208) -- white.7
-- Set the extended palette that has 2 Vecs of 8 PaperColor palette colours
, palette = ExtendedPalette paperColorNormal paperColorBright
2020-10-29 13:00:10 +00:00
}
where
2021-05-28 06:18:47 +00:00
paperColorNormal :: List8 (AlphaColour Double)
paperColorNormal = fromMaybe defaultStandardColours $ mkList8
[ createColour 28 28 28 -- black.0
, createColour 175 0 95 -- red.1
, createColour 95 175 0 -- green.2
, createColour 215 175 95 -- yellow.3
, createColour 95 175 215 -- blue.4
, createColour 128 128 128 -- purple.5
, createColour 215 135 95 -- aqua.6
, createColour 208 208 208 -- white.7
2020-10-29 13:00:10 +00:00
]
2021-05-28 06:18:47 +00:00
paperColorBright :: List8 (AlphaColour Double)
paperColorBright = fromMaybe defaultStandardColours $ mkList8
[ createColour 88 88 88 -- black.8
, createColour 95 175 95 -- red.9
, createColour 175 215 0 -- green.10
, createColour 175 135 215 -- yellow.11
, createColour 255 175 0 -- blue.12
, createColour 255 95 175 -- purple.13
, createColour 0 175 175 -- aqua.14
, createColour 95 135 135 -- white.15
2020-10-29 13:00:10 +00:00
]
2021-05-28 06:18:47 +00:00
-- This is our PaperColor light 'ColourConfig'. It holds all of our light-related settings
paperColorLight :: ColourConfig (AlphaColour Double)
paperColorLight =
2020-10-29 13:00:10 +00:00
defaultColourConfig
2021-05-28 06:18:47 +00:00
-- Set the default background & foreground colour of text of the terminal.
{ backgroundColour = Set (createColour 238 238 238) -- black.0
, foregroundColour = Set (createColour 68 68 68) -- white.7
-- Set the extended palette that has 2 Vecs of 8 PaperColor palette colours
, palette = ExtendedPalette paperColorNormal paperColorBright
2020-10-29 13:00:10 +00:00
}
where
2021-05-28 06:18:47 +00:00
paperColorNormal :: List8 (AlphaColour Double)
paperColorNormal = fromMaybe defaultLightColours $ mkList8
[ createColour 238 238 238 -- black.0
, createColour 175 0 0 -- red.1
, createColour 0 135 0 -- green.2
, createColour 95 135 0 -- yellow.3
, createColour 0 135 175 -- blue.4
, createColour 135 135 135 -- purple.5
, createColour 0 95 135 -- aqua.6
, createColour 68 68 68 -- white.7
2020-10-29 13:00:10 +00:00
]
2021-05-28 06:18:47 +00:00
paperColorBright :: List8 (AlphaColour Double)
paperColorBright = fromMaybe defaultLightColours $ mkList8
[ createColour 188 188 188 -- black.8
, createColour 215 0 0 -- red.9
, createColour 215 0 135 -- green.10
, createColour 135 0 175 -- yellow.11
, createColour 215 95 0 -- blue.12
, createColour 215 95 0 -- purple.13
, createColour 0 95 175 -- aqua.14
, createColour 0 95 135 -- white.15
2020-10-29 13:00:10 +00:00
]
2018-12-04 23:11:41 +00:00
2018-12-06 06:52:50 +00:00
-- This defines the font for the terminal.
2018-12-04 23:11:41 +00:00
fontConf :: FontConfig
fontConf =
defaultFontConfig
2021-05-28 06:18:47 +00:00
-- { fontFamily = "Droid Sans Mono Dotted for Powerline"
-- { fontFamily = "Inconsolata for Powerline"
{ fontFamily = "Inconsolata-g for Powerline"
2020-01-25 14:18:18 +00:00
, fontSize = FontSizePoints 6
2018-12-04 23:11:41 +00:00
}
main :: IO ()
main = do
2021-05-28 06:18:47 +00:00
-- First, create the colour extension based on either PaperColor modules.
--myColourExt <- createColourExtension paperColorDark
myColourExt <- createColourExtension paperColorLight
2018-12-06 02:37:02 +00:00
-- Update 'myTMConfig' with our colour extension.
let newTMConfig = addColourExtension myTMConfig myColourExt
-- Start Termonad with our updated 'TMConfig'.
start newTMConfig