{-# LANGUAGE OverloadedStrings #-}

module Zenith.GUI.Theme
  ( zenithTheme
  ) where

import Data.Default
import Lens.Micro ((&), (+~), (.~), (?~), (^.), at, set)
import Monomer
import Monomer.Core.Themes.BaseTheme
import Monomer.Core.Themes.SampleThemes
import Monomer.Graphics (rgbHex, transparent)
import Monomer.Graphics.ColorTable
import qualified Monomer.Lens as L

baseTextStyle :: TextStyle
baseTextStyle = def & L.fontSize ?~ FontSize 10 & L.fontColor ?~ black

hiliteTextStyle :: TextStyle
hiliteTextStyle = def & L.fontSize ?~ FontSize 10 & L.fontColor ?~ white

zenithTheme :: Theme
zenithTheme =
  baseTheme zgoThemeColors & L.basic . L.labelStyle . L.text ?~ baseTextStyle &
  L.hover .
  L.tooltipStyle . L.text ?~
  baseTextStyle &
  L.hover .
  L.labelStyle . L.text ?~
  baseTextStyle &
  L.basic .
  L.dialogTitleStyle . L.text ?~
  (baseTextStyle & L.fontSize ?~ FontSize 12 & L.font ?~ "Bold") &
  L.hover .
  L.dialogTitleStyle . L.text ?~
  (baseTextStyle & L.fontSize ?~ FontSize 12 & L.font ?~ "Bold") &
  L.basic .
  L.btnStyle . L.text ?~
  baseTextStyle &
  L.hover .
  L.btnStyle . L.text ?~
  baseTextStyle &
  L.focus .
  L.btnStyle . L.text ?~
  baseTextStyle &
  L.focusHover .
  L.btnStyle . L.text ?~
  baseTextStyle &
  L.active .
  L.btnStyle . L.text ?~
  baseTextStyle &
  L.disabled .
  L.btnStyle . L.text ?~
  baseTextStyle &
  L.basic .
  L.btnMainStyle . L.text ?~
  hiliteTextStyle &
  L.hover .
  L.btnMainStyle . L.text ?~
  hiliteTextStyle &
  L.focus .
  L.btnMainStyle . L.text ?~
  hiliteTextStyle &
  L.focusHover .
  L.btnMainStyle . L.text ?~
  hiliteTextStyle &
  L.active .
  L.btnMainStyle . L.text ?~
  hiliteTextStyle &
  L.disabled .
  L.btnMainStyle . L.text ?~
  hiliteTextStyle &
  L.disabled .
  L.btnMainStyle . L.bgColor ?~
  gray07c &
  L.basic .
  L.textFieldStyle . L.text ?~
  baseTextStyle &
  L.hover .
  L.textFieldStyle . L.text ?~
  baseTextStyle &
  L.focus .
  L.textFieldStyle . L.text ?~
  baseTextStyle &
  L.active .
  L.textFieldStyle . L.text ?~
  baseTextStyle &
  L.focusHover .
  L.textFieldStyle . L.text ?~
  baseTextStyle &
  L.basic .
  L.numericFieldStyle . L.text ?~
  baseTextStyle &
  L.hover .
  L.numericFieldStyle . L.text ?~
  baseTextStyle &
  L.focus .
  L.numericFieldStyle . L.text ?~
  baseTextStyle &
  L.active .
  L.numericFieldStyle . L.text ?~
  baseTextStyle &
  L.focusHover .
  L.numericFieldStyle . L.text ?~
  baseTextStyle &
  L.basic .
  L.textAreaStyle . L.text ?~
  baseTextStyle &
  L.hover .
  L.textAreaStyle . L.text ?~
  baseTextStyle &
  L.focus .
  L.textAreaStyle . L.text ?~
  baseTextStyle &
  L.active .
  L.textAreaStyle . L.text ?~
  baseTextStyle &
  L.focusHover .
  L.textAreaStyle . L.text ?~
  baseTextStyle

zenithThemeColors :: BaseThemeColors
zenithThemeColors =
  BaseThemeColors
    { clearColor = gray01
    , sectionColor = gray01
    , btnFocusBorder = blue09
    , btnBgBasic = gray07b
    , btnBgHover = gray08
    , btnBgFocus = gray07c
    , btnBgActive = gray06
    , btnBgDisabled = gray05
    , btnText = gray02
    , btnTextDisabled = gray01
    , btnMainFocusBorder = blue08
    , btnMainBgBasic = btnColor
    , btnMainBgHover = btnHiLite
    , btnMainBgFocus = btnColor
    , btnMainBgActive = btnHiLite
    , btnMainBgDisabled = blue04
    , btnMainText = white
    , btnMainTextDisabled = gray08
    , dialogBg = gray01
    , dialogBorder = gray01
    , dialogText = white
    , dialogTitleText = white
    , emptyOverlay = gray05 & L.a .~ 0.8
    , shadow = gray00 & L.a .~ 0.33
    , externalLinkBasic = blue07
    , externalLinkHover = blue08
    , externalLinkFocus = blue07
    , externalLinkActive = blue06
    , externalLinkDisabled = gray06
    , iconBg = gray08
    , iconFg = gray01
    , inputIconFg = black
    , inputBorder = gray02
    , inputFocusBorder = blue08
    , inputBgBasic = gray04
    , inputBgHover = gray06
    , inputBgFocus = gray05
    , inputBgActive = gray03
    , inputBgDisabled = gray07
    , inputFgBasic = gray06
    , inputFgHover = blue08
    , inputFgFocus = blue08
    , inputFgActive = blue07
    , inputFgDisabled = gray07
    , inputSndBasic = gray05
    , inputSndHover = gray06
    , inputSndFocus = gray05
    , inputSndActive = gray05
    , inputSndDisabled = gray03
    , inputHlBasic = gray07
    , inputHlHover = blue08
    , inputHlFocus = blue08
    , inputHlActive = blue08
    , inputHlDisabled = gray08
    , inputSelBasic = gray06
    , inputSelFocus = blue06
    , inputText = white
    , inputTextDisabled = gray02
    , labelText = white
    , scrollBarBasic = gray01 & L.a .~ 0.2
    , scrollThumbBasic = gray07 & L.a .~ 0.6
    , scrollBarHover = gray01 & L.a .~ 0.4
    , scrollThumbHover = gray07 & L.a .~ 0.8
    , slMainBg = gray00
    , slNormalBgBasic = transparent
    , slNormalBgHover = gray05
    , slNormalText = white
    , slNormalFocusBorder = blue08
    , slSelectedBgBasic = gray04
    , slSelectedBgHover = gray05
    , slSelectedText = white
    , slSelectedFocusBorder = blue08
    , tooltipBorder = gray05
    , tooltipBg = rgbHex "#1D212B"
    , tooltipText = white
    }

zgoThemeColors =
  BaseThemeColors
    { clearColor = gray10 -- gray12,
    , sectionColor = gray09 -- gray11,
    , btnFocusBorder = blue08
    , btnBgBasic = gray07
    , btnBgHover = gray07c
    , btnBgFocus = gray07b
    , btnBgActive = gray06
    , btnBgDisabled = gray05
    , btnText = gray02
    , btnTextDisabled = gray02
    , btnMainFocusBorder = blue09
    , btnMainBgBasic = btnColor
    , btnMainBgHover = btnHiLite
    , btnMainBgFocus = btnColor
    , btnMainBgActive = btnHiLite
    , btnMainBgDisabled = blue04
    , btnMainText = white
    , btnMainTextDisabled = white
    , dialogBg = white
    , dialogBorder = white
    , dialogText = black
    , dialogTitleText = black
    , emptyOverlay = gray07 & L.a .~ 0.8
    , shadow = gray00 & L.a .~ 0.2
    , externalLinkBasic = blue07
    , externalLinkHover = blue08
    , externalLinkFocus = blue07
    , externalLinkActive = blue06
    , externalLinkDisabled = gray06
    , iconBg = gray07
    , iconFg = gray01
    , inputIconFg = black
    , inputBorder = gray06
    , inputFocusBorder = blue07
    , inputBgBasic = gray10
    , inputBgHover = white
    , inputBgFocus = white
    , inputBgActive = gray09
    , inputBgDisabled = gray05
    , inputFgBasic = gray05
    , inputFgHover = blue07
    , inputFgFocus = blue07
    , inputFgActive = blue06
    , inputFgDisabled = gray04
    , inputSndBasic = gray04
    , inputSndHover = gray05
    , inputSndFocus = gray05
    , inputSndActive = gray04
    , inputSndDisabled = gray03
    , inputHlBasic = gray06
    , inputHlHover = blue07
    , inputHlFocus = blue07
    , inputHlActive = blue06
    , inputHlDisabled = gray05
    , inputSelBasic = gray07
    , inputSelFocus = blue08
    , inputText = black
    , inputTextDisabled = gray02
    , labelText = black
    , scrollBarBasic = gray03 & L.a .~ 0.2
    , scrollThumbBasic = gray01 & L.a .~ 0.2
    , scrollBarHover = gray07 & L.a .~ 0.8
    , scrollThumbHover = gray05 & L.a .~ 0.8
    , slMainBg = white
    , slNormalBgBasic = transparent
    , slNormalBgHover = gray09
    , slNormalText = black
    , slNormalFocusBorder = blue07
    , slSelectedBgBasic = gray08
    , slSelectedBgHover = gray09
    , slSelectedText = black
    , slSelectedFocusBorder = blue07
    , tooltipBorder = gray08
    , tooltipBg = gray07
    , tooltipText = black
    }

--black = rgbHex "#000000"
{-white = rgbHex "#FFFFFF"-}
btnColor = rgbHex "#ff5722" --rgbHex "#1818B2"

btnHiLite = rgbHex "#207DE8"

blue01 = rgbHex "#002159"

blue02 = rgbHex "#01337D"

blue03 = rgbHex "#03449E"

blue04 = rgbHex "#0552B5"

blue05 = rgbHex "#0967D2"

blue05b = rgbHex "#0F6BD7"

blue05c = rgbHex "#1673DE"

blue06 = rgbHex "#2186EB"

blue06b = rgbHex "#2489EE"

blue06c = rgbHex "#2B8FF6"

blue07 = rgbHex "#47A3F3"

blue07b = rgbHex "#50A6F6"

blue07c = rgbHex "#57ACFC"

blue08 = rgbHex "#7CC4FA"

blue09 = rgbHex "#BAE3FF"

blue10 = rgbHex "#E6F6FF"

gray00 = rgbHex "#111111"

gray01 = rgbHex "#2E2E2E"

gray02 = rgbHex "#393939"

gray03 = rgbHex "#515151"

gray04 = rgbHex "#626262"

gray05 = rgbHex "#7E7E7E"

gray06 = rgbHex "#9E9E9E"

gray07 = rgbHex "#B1B1B1"

gray07b = rgbHex "#B4B4B4"

gray07c = rgbHex "#BBBBBB"

gray08 = rgbHex "#CFCFCF"

gray09 = rgbHex "#E1E1E1"

gray10 = rgbHex "#F7F7F7"
