Skip to content

Commit

Permalink
Generate random color when new shadow is added
Browse files Browse the repository at this point in the history
  • Loading branch information
carlotm committed Jan 14, 2024
1 parent 29000a4 commit e5a4ca1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Umbra.elm
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,7 @@ update msg model =
)

AddShadow ->
( { model
| shadows = makeShadow model :: model.shadows
, selectedShadowId = ""
}
, Random.generate GotRandomColor randomColor
)
( model, Random.generate GotRandomColor randomColor )

ExportCSS ->
( { model
Expand All @@ -145,7 +140,12 @@ update msg model =
)

GotRandomColor v ->
( { model | someRandomColor = v }, Cmd.none )
( { model
| shadows = makeShadow model v :: model.shadows
, selectedShadowId = ""
}
, Cmd.none
)



Expand Down Expand Up @@ -426,16 +426,16 @@ updateShadow s param value =
{ s | color = value }


makeShadow : Model -> Shadow
makeShadow model =
makeShadow : Model -> Color -> Shadow
makeShadow model c =
let
ids =
List.map shadowId model.shadows

maxId =
maxOrZero ids
in
Shadow (String.fromInt maxId) "0" "0" "0" "0" "#000000"
Shadow (String.fromInt maxId) "0" "0" "0" "0" (colorToString c)


maxOrZero : List Int -> Int
Expand Down

0 comments on commit e5a4ca1

Please sign in to comment.