Merge pull request #50 from AAorris/master

Remove need for double dashes when accessing theme vars. Add theme example.
This commit is contained in:
Лu Лinveгa 2019-07-15 17:20:06 +12:00 committed by GitHub
commit ef9e72cdcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 1 deletions

View File

@ -189,7 +189,8 @@ function Library (ronin) {
} }
this.theme = (variable, el = document.documentElement) => { this.theme = (variable, el = document.documentElement) => {
return getComputedStyle(el).getPropertyValue(variable) // ex. styleprop('--f_high') to get css variable value // ex. (theme "f_main") -> :root { --f_main: "#fff" }
return getComputedStyle(el).getPropertyValue(`--${variable}`)
} }
// Pixels // Pixels

30
examples/theme.lisp Normal file
View File

@ -0,0 +1,30 @@
((clear)
(def col
(lambda
(i)
(of
((theme "f_high")
(theme "f_med")
(theme "f_low")
(theme "f_inv")
(theme "b_high")
(theme "b_med")
(theme "b_low")
(theme "b_inv"))
(mod i 8))))
(def rec
(lambda
(v i)
(if (gt v 0)
((fill
(circle
(add
(div (of (frame) "w") 1.6)
(mul 1.5 v))
(mul 10 v)
(mul v (div v 5)))
(col i))
(rec
(sub v 3)
(add i 1))))))
(rec 40 0))