-- |

module Hum.Attributes where

import           Brick.AttrMap
import           Brick.Types
import           Brick.Widgets.Core
import           Brick.Widgets.List             ( listAttr
                                                , listSelectedAttr
                                                , listSelectedFocusedAttr
                                                )
import qualified Brick.Util                    as BU
import           Graphics.Vty                   ( defAttr )
import qualified Graphics.Vty                  as Vty


humAttrMap :: AttrMap
humAttrMap :: AttrMap
humAttrMap = Attr -> [(AttrName, Attr)] -> AttrMap
attrMap
  Attr
defAttr
  [ (AttrName
listAttr               , Attr -> Style -> Attr
Vty.withStyle (Color -> Attr
BU.fg Color
Vty.white) Style
Vty.defaultStyleMask)
  , (AttrName
listSelectedAttr       , Attr -> Style -> Attr
Vty.withStyle Attr
defAttr Style
Vty.underline)
  , (AttrName
listSelectedFocusedAttr, Attr -> Style -> Attr
Vty.withStyle Attr
defAttr Style
Vty.reverseVideo)
  , (AttrName
listHighlightedAttr    , Color -> Attr
BU.fg Color
Vty.yellow)
  , (AttrName
headerAttr             , Attr -> Style -> Attr
Vty.withStyle Attr
defAttr Style
Vty.underline)
  , (AttrName
queueAlbumAttr         , Color -> Attr
BU.fg Color
Vty.red)
  , (AttrName
queueTrackAttr         , Color -> Attr
BU.fg Color
Vty.magenta)
  , (AttrName
queueTitleAttr         , Color -> Attr
BU.fg Color
Vty.cyan)
  , (AttrName
queueArtistAttr        , Color -> Attr
BU.fg Color
Vty.green)
  , (AttrName
queueTimeAttr          , Color -> Attr
BU.fg Color
Vty.blue)
  , (AttrName
queueDateAttr          , Color -> Attr
BU.fg Color
Vty.yellow)
  , ( AttrName
queueNowPlayingAttr
    , Attr -> Style -> Attr
Vty.withStyle (Attr -> Style -> Attr
Vty.withStyle Attr
defAttr Style
Vty.bold) Style
Vty.underline
    )
  , (AttrName
queueTitleBoldAttr, Attr -> Style -> Attr
Vty.withStyle Attr
defAttr Style
Vty.bold)
  , (AttrName
editorAttr          , Color -> Attr
BU.bg Color
Vty.black)
  ]

wobAttr :: Vty.Attr
wobAttr :: Attr
wobAttr = Color -> Attr
BU.fg Color
Vty.white

queueAttr, queueAlbumAttr, queueTitleAttr, queueTrackAttr, queueArtistAttr, queueTimeAttr, queueDateAttr
  :: AttrName
queueAttr :: AttrName
queueAttr = AttrName
"queue"
queueAlbumAttr :: AttrName
queueAlbumAttr = AttrName
queueAttr AttrName -> AttrName -> AttrName
forall a. Semigroup a => a -> a -> a
<> AttrName
"album"
queueTitleAttr :: AttrName
queueTitleAttr = AttrName
queueAttr AttrName -> AttrName -> AttrName
forall a. Semigroup a => a -> a -> a
<> AttrName
"title"
queueTrackAttr :: AttrName
queueTrackAttr = AttrName
queueAttr AttrName -> AttrName -> AttrName
forall a. Semigroup a => a -> a -> a
<> AttrName
"track"
queueArtistAttr :: AttrName
queueArtistAttr = AttrName
queueAttr AttrName -> AttrName -> AttrName
forall a. Semigroup a => a -> a -> a
<> AttrName
"artist"
queueTimeAttr :: AttrName
queueTimeAttr = AttrName
queueAttr AttrName -> AttrName -> AttrName
forall a. Semigroup a => a -> a -> a
<> AttrName
"time"
queueDateAttr :: AttrName
queueDateAttr = AttrName
queueAttr AttrName -> AttrName -> AttrName
forall a. Semigroup a => a -> a -> a
<> AttrName
"date"

headerAttr :: AttrName
headerAttr :: AttrName
headerAttr = AttrName
"header"

listHighlightedAttr :: AttrName
listHighlightedAttr :: AttrName
listHighlightedAttr = AttrName
listAttr AttrName -> AttrName -> AttrName
forall a. Semigroup a => a -> a -> a
<> AttrName
"highlighted"
queueNowPlayingAttr :: AttrName
queueNowPlayingAttr :: AttrName
queueNowPlayingAttr = AttrName
queueAttr AttrName -> AttrName -> AttrName
forall a. Semigroup a => a -> a -> a
<> AttrName
"now playing"

queueTitleBoldAttr :: AttrName
queueTitleBoldAttr :: AttrName
queueTitleBoldAttr = AttrName
queueTitleAttr AttrName -> AttrName -> AttrName
forall a. Semigroup a => a -> a -> a
<> AttrName
"bold"


editorAttr :: AttrName
editorAttr :: AttrName
editorAttr = AttrName
"editor"

highlightOverQueueAttrs :: Widget n -> Widget n
highlightOverQueueAttrs :: Widget n -> Widget n
highlightOverQueueAttrs = (AttrMap -> AttrMap) -> Widget n -> Widget n
forall n. (AttrMap -> AttrMap) -> Widget n -> Widget n
updateAttrMap
  ([(AttrName, AttrName)] -> AttrMap -> AttrMap
mapAttrNames
    (   (AttrName
listHighlightedAttr, )
    (AttrName -> (AttrName, AttrName))
-> [AttrName] -> [(AttrName, AttrName)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [ AttrName
queueAlbumAttr
        , AttrName
queueTrackAttr
        , AttrName
queueTitleAttr
        , AttrName
queueArtistAttr
        , AttrName
queueTimeAttr
        ]
    )
  )