Apply NO_COLOR to dimAttributes as well to cover all tui colors
This commit is contained in:
		
							parent
							
								
									a08e624309
								
							
						
					
					
						commit
						ead9d31647
					
				@ -119,8 +119,8 @@ showKey (Vty.KDown) = "↓"
 | 
				
			|||||||
showKey key = tail (show key)
 | 
					showKey key = tail (show key)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ui :: BrickState -> Widget String
 | 
					ui :: AttrMap -> BrickState -> Widget String
 | 
				
			||||||
ui BrickState { appSettings = as@(BrickSettings {}), ..}
 | 
					ui dimAttrs BrickState { appSettings = as@(BrickSettings {}), ..}
 | 
				
			||||||
  = ( padBottom Max
 | 
					  = ( padBottom Max
 | 
				
			||||||
    $ ( withBorderStyle unicode
 | 
					    $ ( withBorderStyle unicode
 | 
				
			||||||
      $ borderWithLabel (str "GHCup")
 | 
					      $ borderWithLabel (str "GHCup")
 | 
				
			||||||
@ -151,9 +151,9 @@ ui BrickState { appSettings = as@(BrickSettings {}), ..}
 | 
				
			|||||||
        ver = case lCross of
 | 
					        ver = case lCross of
 | 
				
			||||||
          Nothing -> T.unpack . prettyVer $ lVer
 | 
					          Nothing -> T.unpack . prettyVer $ lVer
 | 
				
			||||||
          Just c  -> T.unpack (c <> "-" <> prettyVer lVer)
 | 
					          Just c  -> T.unpack (c <> "-" <> prettyVer lVer)
 | 
				
			||||||
        dim = if lNoBindist
 | 
					        dim
 | 
				
			||||||
          then updateAttrMap (const dimAttributes) . withAttr "no-bindist"
 | 
					          | lNoBindist = updateAttrMap (const dimAttrs) . withAttr "no-bindist"
 | 
				
			||||||
          else id
 | 
					          | otherwise  = id
 | 
				
			||||||
        hooray
 | 
					        hooray
 | 
				
			||||||
          | elem Latest lTag && not lInstalled =
 | 
					          | elem Latest lTag && not lInstalled =
 | 
				
			||||||
              withAttr "hooray"
 | 
					              withAttr "hooray"
 | 
				
			||||||
@ -240,12 +240,12 @@ minHSize :: Int -> Widget n -> Widget n
 | 
				
			|||||||
minHSize s' = hLimit s' . vLimit 1 . (<+> fill ' ')
 | 
					minHSize s' = hLimit s' . vLimit 1 . (<+> fill ' ')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
app :: AttrMap -> App BrickState e String
 | 
					app :: AttrMap -> AttrMap -> App BrickState e String
 | 
				
			||||||
app attributes =
 | 
					app attrs dimAttrs =
 | 
				
			||||||
  App { appDraw         = \st -> [ui st]
 | 
					  App { appDraw         = \st -> [ui dimAttrs st]
 | 
				
			||||||
  , appHandleEvent  = eventHandler
 | 
					  , appHandleEvent  = eventHandler
 | 
				
			||||||
  , appStartEvent   = return
 | 
					  , appStartEvent   = return
 | 
				
			||||||
  , appAttrMap      = const attributes
 | 
					  , appAttrMap      = const attrs
 | 
				
			||||||
  , appChooseCursor = neverShowCursor
 | 
					  , appChooseCursor = neverShowCursor
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -274,13 +274,15 @@ defaultAttributes no_color = attrMap
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    withStyle                 = Vty.withStyle
 | 
					    withStyle                 = Vty.withStyle
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dimAttributes :: AttrMap
 | 
					dimAttributes :: Bool -> AttrMap
 | 
				
			||||||
dimAttributes = attrMap
 | 
					dimAttributes no_color = attrMap
 | 
				
			||||||
  (Vty.defAttr `Vty.withStyle` Vty.dim)
 | 
					  (Vty.defAttr `Vty.withStyle` Vty.dim)
 | 
				
			||||||
  [ ("active"    , Vty.defAttr `Vty.withBackColor` Vty.blue)
 | 
					  [ ("active"    , Vty.defAttr `withBackColor` Vty.blue)
 | 
				
			||||||
  , ("no-bindist", Vty.defAttr `Vty.withStyle` Vty.dim)
 | 
					  , ("no-bindist", Vty.defAttr `Vty.withStyle` Vty.dim)
 | 
				
			||||||
  ]
 | 
					  ]
 | 
				
			||||||
 | 
					  where
 | 
				
			||||||
 | 
					    withBackColor | no_color  = \attr _ -> attr `Vty.withStyle` Vty.reverseVideo
 | 
				
			||||||
 | 
					                  | otherwise = Vty.withBackColor
 | 
				
			||||||
 | 
					
 | 
				
			||||||
eventHandler :: BrickState -> BrickEvent n e -> EventM n (Next BrickState)
 | 
					eventHandler :: BrickState -> BrickEvent n e -> EventM n (Next BrickState)
 | 
				
			||||||
eventHandler st@(BrickState {..}) ev = do
 | 
					eventHandler st@(BrickState {..}) ev = do
 | 
				
			||||||
@ -529,13 +531,13 @@ brickMain s l av pfreq' = do
 | 
				
			|||||||
  writeIORef logger'   l
 | 
					  writeIORef logger'   l
 | 
				
			||||||
  let runLogger = myLoggerT l
 | 
					  let runLogger = myLoggerT l
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  attributes <- defaultAttributes <$> isJust <$> lookupEnv "NO_COLOR"
 | 
					  no_color <- isJust <$> lookupEnv "NO_COLOR"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  eAppData <- getAppData (Just av) pfreq'
 | 
					  eAppData <- getAppData (Just av) pfreq'
 | 
				
			||||||
  case eAppData of
 | 
					  case eAppData of
 | 
				
			||||||
    Right ad ->
 | 
					    Right ad ->
 | 
				
			||||||
      defaultMain
 | 
					      defaultMain
 | 
				
			||||||
          (app attributes)
 | 
					          (app (defaultAttributes no_color) (dimAttributes no_color))
 | 
				
			||||||
          (BrickState ad
 | 
					          (BrickState ad
 | 
				
			||||||
                    defaultAppSettings
 | 
					                    defaultAppSettings
 | 
				
			||||||
                    (constructList ad defaultAppSettings Nothing)
 | 
					                    (constructList ad defaultAppSettings Nothing)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user