Use Azure as expected

This commit is contained in:
Tessa Kelly 2022-04-18 18:05:57 -07:00
parent 8a0267136b
commit fe5cbf65bc
3 changed files with 12 additions and 9 deletions

View File

@ -1,6 +1,7 @@
module Nri.Ui.Colors.Extra exposing
( toCssColor, fromCssColor
, withAlpha
, toCssString
)
{-| Helpers for working with colors.
@ -10,6 +11,7 @@ module Nri.Ui.Colors.Extra exposing
@docs toCssColor, fromCssColor
@docs withAlpha
@docs toCssString
-}
@ -44,3 +46,9 @@ withAlpha 0.5 grassland -- "{ value = "rgba(86, 191, 116, 0.5)", color = Compati
withAlpha : Float -> Css.Color -> Css.Color
withAlpha alpha { red, green, blue } =
Css.rgba red green blue alpha
{-| -}
toCssString : Css.Color -> String
toCssString =
SolidColor.toRGBString << fromCssColor

View File

@ -21,11 +21,10 @@ import Css exposing (..)
import Html.Styled as Html exposing (Html)
import Html.Styled.Attributes exposing (css)
import Html.Styled.Events
import Nri.Ui.Colors.Extra
import Nri.Ui.Colors.Extra exposing (toCssString)
import Nri.Ui.Colors.V1
import Nri.Ui.CssVendorPrefix.V1 as CssVendorPrefix
import Nri.Ui.Table.V5
import SolidColor
import Svg.Styled as Svg
import Svg.Styled.Attributes as SvgAttributes
@ -363,8 +362,3 @@ sortArrow direction active =
[ Svg.polygon [ SvgAttributes.points "0 6 4 0 8 6 0 6" ] []
]
]
toCssString : Css.Color -> String
toCssString =
SolidColor.toRGBString << Nri.Ui.Colors.Extra.fromCssColor

View File

@ -13,6 +13,7 @@ module Nri.Ui.Switch.V2 exposing
- Fixes invalid ARIA use, [conformance requirements](https://www.w3.org/TR/html-aria/#docconformance)
- labels should only support strings (this is the only way they're actually used in practice)
- extends API to be more consistent with other form/control components
- Use Colors.azure instead of a hardcoded hex
@docs view, label
@ -34,6 +35,7 @@ import Css.Media
import Html.Styled as WildWildHtml
import Html.Styled.Attributes as Attributes
import Html.Styled.Events as Events
import Nri.Ui.Colors.Extra exposing (toCssString)
import Nri.Ui.Colors.V1 as Colors
import Nri.Ui.Html.Attributes.V2 as Extra
import Nri.Ui.Svg.V1 exposing (Svg)
@ -164,8 +166,7 @@ view attrs isOn =
, Css.pseudoClass "focus-within"
[ Global.descendants
[ Global.class "switch-slider"
[ -- azure, but can't use the Color type here
Css.property "stroke" "#146AFF"
[ Css.property "stroke" (toCssString Colors.azure)
, Css.property "stroke-width" "3px"
]
]