Skip to content

Commit

Permalink
FIx build
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirlogachev committed May 3, 2024
1 parent 2ab205a commit 2a532f9
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 51 deletions.
45 changes: 24 additions & 21 deletions example/elm.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
{
"type": "application",
"source-directories": ["src", ".elm-land/src", "../src"],
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"elm/browser": "1.0.2",
"elm/core": "1.0.5",
"elm/html": "1.0.0",
"elm/json": "1.1.3",
"elm/url": "1.0.0",
"hmsk/elm-vite-plugin-helper": "1.0.1",
"mdgriffith/elm-ui": "1.1.8",
"vladimirlogachev/elm-modular-grid": "2.0.1"
"type": "application",
"source-directories": [
"src",
".elm-land/src",
"../src"
],
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"elm/browser": "1.0.2",
"elm/core": "1.0.5",
"elm/html": "1.0.0",
"elm/json": "1.1.3",
"elm/url": "1.0.0",
"mdgriffith/elm-ui": "1.1.8",
"vladimirlogachev/elm-modular-grid": "2.0.1"
},
"indirect": {
"elm/time": "1.0.0",
"elm/virtual-dom": "1.0.3"
}
},
"indirect": {
"elm/time": "1.0.0",
"elm/virtual-dom": "1.0.3"
"test-dependencies": {
"direct": {},
"indirect": {}
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}
2 changes: 1 addition & 1 deletion example/review/src/ReviewConfig.elm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ config =
, NoUnused.Patterns.rule
, NoExposingEverything.rule
, NoUnused.Variables.rule
, NoImportingEverything.rule [ "Element" ]
, NoImportingEverything.rule [ "Element", "GridLayout1", "GridLayout2", "GridLayout3" ]
, NoMissingTypeAnnotation.rule
, NoMissingTypeAnnotationInLetIn.rule
, NoPrematureLetComputation.rule
Expand Down
34 changes: 20 additions & 14 deletions example/src/Pages/Home_.elm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module Pages.Home_ exposing (Model, Msg, page)

import Color
import Effect
import Html.Attributes
import Element exposing (..)
import Element.Background as Background
import Element.Font as Font
Expand All @@ -14,7 +13,6 @@ import Route exposing (Route)
import Shared
import TextStyle
import View exposing (View)
import VitePluginHelper


type alias Model =
Expand Down Expand Up @@ -43,7 +41,7 @@ page shared _ =
color1 : ExtraColor
color1 =
ExtraColor.oklchPercent 68.64 0.255 36.4


color2 : ExtraColor
color2 =
Expand All @@ -54,11 +52,16 @@ color3 : ExtraColor
color3 =
ExtraColor.oklchPercent 83.93 0.336 147.57


color4 : ExtraColor
color4 =
ExtraColor.oklchPercent 91.28 0.208 102.04


pageTitle : String
pageTitle =
"elm-ui color extra"



-- VIEW
Expand All @@ -67,7 +70,7 @@ color4 =
view : Shared.Model -> View msg
view { layout } =
{ title = "elm-ui-color-extra"
, attributes = [ Background.color Color.black ]
, attributes = [ Background.color Color.black, Font.color Color.white ]
, element =
viewMobile layout
}
Expand All @@ -79,16 +82,19 @@ viewMobile layout =
[ width fill
, spacing layout.grid.gutter
]
(gridRow layout
[ gridColumn layout { widthSteps = 3 } [Font.color Color.white ] [text "OKLCH" ]
, gridColumn layout { widthSteps = 3 } [Font.color Color.white ] [text "RGB fallback" ]
]:: List.map (viewColor layout) [color1, color2, color3, color4])

([ paragraph TextStyle.header [ text pageTitle ]
, gridRow layout
[ gridColumn layout { widthSteps = 2 } [ Font.color Color.white ] [ text "OKLCH" ]
, gridColumn layout { widthSteps = 2 } [ Font.color Color.white ] [ text "RGB fallback" ]
]
]
++ List.map (viewColor layout) [ color1, color2, color3, color4 ]
)


viewColor : LayoutState -> ExtraColor -> Element msg
viewColor layout c =
gridRow layout
[ gridBox layout { widthSteps = 3, heightSteps = 3 } [ ExtraColor.backgroundColor c ] [ ]
, gridBox layout { widthSteps = 3, heightSteps = 3 } [ Background.color (ExtraColor.toRgba c) ] [ ]
]

gridRow layout
[ gridBox layout { widthSteps = 2, heightSteps = 2 } [ ExtraColor.backgroundColor c ] []
, gridBox layout { widthSteps = 2, heightSteps = 2 } [ Background.color (ExtraColor.toRgba c) ] []
]
11 changes: 3 additions & 8 deletions example/src/TextStyle.elm
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
module TextStyle exposing (body, headerMobile, subheaderMobile)
module TextStyle exposing (body, header)

import Element exposing (..)
import Element.Font as Font


headerMobile : List (Attribute msg)
headerMobile =
header : List (Attribute msg)
header =
[ Font.size 55, Font.bold, Font.family [ Font.typeface "Inter", Font.sansSerif ] ]


subheaderMobile : List (Attribute msg)
subheaderMobile =
[ Font.size 34, Font.medium, Font.family [ Font.typeface "Inter", Font.sansSerif ] ]


body : List (Attribute msg)
body =
[ Font.size 20, Font.regular, Font.family [ Font.typeface "Inter", Font.sansSerif ] ]
20 changes: 13 additions & 7 deletions src/Culori.elm
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ convertLchToLab { l, c, h, alpha } =
convertOklabToLrgb : LabColor -> RgbaColor
convertOklabToLrgb { l, a, b, alpha } =
let
l_ : Float
l_ =
l
* 0.9999999984505198
Expand All @@ -63,6 +64,7 @@ convertOklabToLrgb { l, a, b, alpha } =
* b
|> (\x -> x ^ 3)

m : Float
m =
l
* 1.0000000088817609
Expand All @@ -72,6 +74,7 @@ convertOklabToLrgb { l, a, b, alpha } =
* b
|> (\x -> x ^ 3)

s : Float
s =
l
* 1.0000000546724108
Expand All @@ -91,17 +94,20 @@ convertOklabToLrgb { l, a, b, alpha } =
fn : Float -> Float
fn c =
let
absC : Float
absC =
abs c

sign =
if c < 0 then
-1

else
1
in
if absC > 0.0031308 then
let
sign : Float
sign =
if c < 0 then
-1

else
1
in
sign * (1.055 * (absC ^ (1 / 2.4)) - 0.055)

else
Expand Down

0 comments on commit 2a532f9

Please sign in to comment.