Open
Description
Code from the ellie example:
module Main exposing (main)
import Browser
import Html.Styled exposing (..)
import Html.Styled.Lazy exposing (..)
import Css exposing (..)
import Html.Styled.Attributes exposing (css)
strings =
[ "A" , "B", "C"]
viewString : String -> Html msg
viewString str =
let
strColour =
if str == "A"
then rgb 166 11 0
else rgb 0 110 29
in
option [ css [ color strColour ] ] [ text str ]
viewStrings : Html msg
viewStrings =
strings
|> List.map (\txt -> lazy viewString txt )
|> select [ ]
view _ =
viewStrings
|> toUnstyled
main : Program () () ()
main =
Browser.sandbox
{ init = ()
, view = view
, update = \_ _ -> ()
}
I want to colour the individual options differently.
With lazy:
Activity