Fork me on GitHub
#hoplon
<
2016-01-08
>
chromalchemy21:01:05

I'm having trouble getting functions from these (css) color libs, working within hlisp.... https://github.com/noprompt/garden/wiki/Color#introduction https://github.com/thi-ng/color#example-usage

chromalchemy21:01:32

They work fine inside a garden.clj file, but not in my .hl file (inside a defelem....?)

chromalchemy21:01:40

I've tried (div :css (cell= {:background-color (color/hsl 0 50 50)})) to no avail for [garden.color :as color]

chromalchemy21:01:19

Any suggestions?

flyboarder21:01:52

@chromalchemy: I dont see any cell’s in your formula cell

chromalchemy21:01:56

Do I need to use cells to run the (color/hsl) function as an attribute value, even if it doesn't vary at runtime?

flyboarder21:01:09

formula cells are for changing attribute values when a cell gets a value change

chromalchemy21:01:32

I was trying the functions within a defelem (which I am using for html fragments), maybe that was the problem?

chromalchemy21:01:39

..but that should be able to work no? Setting up a custom element with attributes derived from other functions...

flyboarder21:01:56

yes, i dont know that the :css attribute works that way tho

flyboarder21:01:10

i have only ever used it for class names

flyboarder21:01:38

I would convert your css to a string and use it for a :style attribute

flyboarder21:01:20

:style (clojure.string/join [“background-color:” (color/hsl 0 50 50) “;"])

flyboarder21:01:38

im sure there are better ways

chromalchemy22:01:18

Thanks, I'll try that! Can you use that approach with a map of multiple rules?

flyboarder22:01:55

all you are doing is appending to a string with that approach, you can add as many segments as you like

chromalchemy22:01:38

Ok, thanks again, I'll play around with that.

genRaiy22:01:24

btw do I need to attest to some kind of contributor agreement?