Skip to content

Commit

Permalink
Make website thumbnails nicer
Browse files Browse the repository at this point in the history
  • Loading branch information
flo committed May 7, 2018
1 parent 2ca3b76 commit 19cf572
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
13 changes: 13 additions & 0 deletions web/lib/Helper.elm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import Json.Encode as JE exposing (Value)
import Uuid
import Time exposing (Time)
import Task exposing (Task)
import Murmur3
import Color exposing (Color)


-- Update
Expand Down Expand Up @@ -429,6 +431,17 @@ encodeSet valueEncoder set =
-- Random


randomColorFromString : String -> Color
randomColorFromString str =
let
c =
Random.initialSeed (Murmur3.hashString 42 str)
|> Random.step (Random.float 0 (2 * pi))
|> Tuple.first
in
Color.hsl c 0.77 0.43


pcgToCore : RandomP.Seed -> Random.Seed
pcgToCore seedP =
Random.initialSeed (RandomP.step (RandomP.int RandomP.minInt RandomP.maxInt) seedP |> Tuple.first)
Expand Down
9 changes: 5 additions & 4 deletions web/src/Elements.elm
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,14 @@ siteLogo siteName =
-- For now just use the first letter on a nice background
el
[ Border.rounded 20
, width (px 28)
, height (px 28)
, Background.color Styles.foregroundColor
, Font.color Styles.backgroundColor
, width (px 34)
, height (px 34)
, Background.color (Helper.randomColorFromString siteName)
, Font.size 24
, Font.center
]
(Element.text letter)
(el [ centerY ] (Element.text letter))


hashIcon : String -> Element msg
Expand Down
1 change: 0 additions & 1 deletion web/src/Views/Pairing.elm
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ view config isAndroid diag =
(rest ++ [ Elements.button (Just config.onGetTokenClicked) "Get a new token" ])
]
in
-- TODO: Scan QR code, I could probably use https://github.com/felipenmoura/qr-code-scanner
column [ height shrink, spacing (Styles.paddingScale 2) ]
[ case ( diag.token, diag.tokenSubmitStatus ) of
( _, Submitted ) ->
Expand Down

0 comments on commit 19cf572

Please sign in to comment.