Skip to content
This repository has been archived by the owner on Jul 19, 2022. It is now read-only.

Hashvatar: use background hue for tendrils #305

Merged
merged 1 commit into from
Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Hashvatar.elm
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ toGrid slots =
selectTendrils grid_ =
let
tendrils =
getIn grid_.tendrils (Color.harmonizesWith grid_.background)
getIn grid_.tendrils (Color.inSameHue grid_.background)
in
Maybe.map
(\tr ->
Expand Down
92 changes: 92 additions & 0 deletions src/UI/Color.elm
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,98 @@ filterLuminance pred colors_ =



-- Hue


type Hue
= Gray
| Orange
| Pink
| Purple
| Blue
| Green


hueOf : Color -> Hue
hueOf color =
if isGray color then
Gray

else if isOrange color then
Orange

else if isPink color then
Pink

else if isPurple color then
Purple

else if isBlue color then
Blue

else
Green


{-| Get all the other colors in the same hue as the given color
-}
inSameHue : Color -> List Color
inSameHue color =
let
sameHue =
case hueOf color of
Gray ->
grays

Orange ->
oranges

Pink ->
pinks

Purple ->
purples

Blue ->
blues

Green ->
greens
in
List.filter (\c -> c /= color) sameHue


isGray : Color -> Bool
isGray color =
List.member color grays


isOrange : Color -> Bool
isOrange color =
List.member color oranges


isPink : Color -> Bool
isPink color =
List.member color pinks


isPurple : Color -> Bool
isPurple color =
List.member color purples


isBlue : Color -> Bool
isBlue color =
List.member color blues


isGreen : Color -> Bool
isGreen color =
List.member color greens



-- Grays


Expand Down