module Yi.Style.Solarized ( solarizedTheme ) where
import Data.Bits (shiftR)
import Data.Monoid (mappend, mempty)
import Data.Word (Word32)
import Yi
solarizedTheme :: Proto UIStyle
solarizedTheme = defaultTheme `override` \sets _ -> sets
{ baseAttributes = emptyAttributes { foreground = solarizedBase1
, background = solarizedBase03
, reverseAttr = False }
, modelineAttributes = emptyAttributes { foreground = solarizedBase1
, background = solarizedBase03
, reverseAttr = False }
, tabBarAttributes = emptyAttributes { foreground = solarizedBase1
, background = solarizedBase03
, reverseAttr = False }
, tabInFocusStyle = withFg solarizedBase1 `mappend` withBg solarizedBase03
, selectedStyle = withBg solarizedBase03
, hintStyle = withBg solarizedBase03
, builtinStyle = withFg solarizedCyan
, commentStyle = withFg solarizedBase01
, keywordStyle = withFg solarizedRed
, stringStyle = withFg solarizedRed
, typeStyle = withFg solarizedYellow
, errorStyle = withFg solarizedRed `mappend` withBd True
, operatorStyle = withFg solarizedBlue
, importStyle = withFg solarizedGreen
, numberStyle = withFg solarizedGreen
, preprocessorStyle = withFg solarizedBase3
}
rgb :: Word32 -> Color
rgb x = RGB (fi (x `shiftR` 16))
(fi (x `shiftR` 8))
(fi x)
where
fi = fromIntegral
solarizedBase03 :: Color
solarizedBase03 = rgb 0x000000
solarizedBase02 :: Color
solarizedBase02 = rgb 0x073642
solarizedBase01 :: Color
solarizedBase01 = rgb 0x586E75
solarizedBase00 :: Color
solarizedBase00 = rgb 0x657B83
solarizedBase0 :: Color
solarizedBase0 = rgb 0x839496
solarizedBase1 :: Color
solarizedBase1 = rgb 0x93A1A1
solarizedBase2 :: Color
solarizedBase2 = rgb 0xEEE8d5
solarizedBase3 :: Color
solarizedBase3 = rgb 0xFDF6e3
solarizedYellow :: Color
solarizedYellow = rgb 0xB58900
solarizedOrange :: Color
solarizedOrange = rgb 0xCB4B16
solarizedRed :: Color
solarizedRed = rgb 0xDC322F
solarizedMagenta :: Color
solarizedMagenta = rgb 0xD33682
solarizedViolet :: Color
solarizedViolet = rgb 0x6C71C4
solarizedBlue :: Color
solarizedBlue = rgb 0x268BD2
solarizedCyan :: Color
solarizedCyan = rgb 0x2AA198
solarizedGreen :: Color
solarizedGreen = rgb 0x859900