This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-01-19
Channels
- # announcements (2)
- # babashka (1)
- # beginners (159)
- # biff (19)
- # clj-http (2)
- # clj-kondo (14)
- # clojure (105)
- # clojure-argentina (1)
- # clojure-art (3)
- # clojure-europe (17)
- # clojure-nl (1)
- # clojure-norway (10)
- # clojure-spain (1)
- # clojure-spec (3)
- # clojure-uk (26)
- # clojurescript (15)
- # conjure (4)
- # cursive (17)
- # datomic (8)
- # gratitude (1)
- # humbleui (1)
- # hyperfiddle (30)
- # joyride (10)
- # kaocha (1)
- # lsp (41)
- # malli (11)
- # off-topic (1)
- # pedestal (1)
- # polylith (12)
- # releases (1)
- # sci (4)
- # shadow-cljs (136)
- # squint (32)
- # tools-deps (28)
Am I overlooking some simple way to turn a "hue" into an RGB value? It seems odd that you can use various colorspaces in CSS, but the same doesn't seem to be exposed through JS.
I realized something last night right after getting in bed - I can just use "hsl(h,s,l)"
in the setProperty
call :man-facepalming:
Could anyone recommend a (edit: seedable) pseudrandom number generator library/code for clojurescript? Alternatively an algorithm that's easy to implement. It doesn't have to be cryptographically secure.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random?
There's the built-in function too, rand
. Source: https://github.com/clojure/clojurescript/blob/r1.11.60/src/main/cljs/cljs/core.cljs#L11115
ClojureScript can also consume from any npm lib, so randomatic, faker, etc. are all viable.
I should have clarified a seedable pseudorandom number generator, which Math.random() is not
Ah, that's makes more sense. You could use Math.sin instead if cryptographic security isn't a concern.
This is JS, but should be easy to convert to CLJS:
function seededRandom(seed: number) {
let x = Math.sin(seed++) * 10000;
return x - Math.floor(x);
}
Worked well for projects I usedIt's still important that they're evenly distributed, so i think i'll go for the npm route 🙂
@U0552GV2X32 I'm a fan of seedrandom: https://github.com/davidbau/seedrandom - it has a cool mode where you can install it as the global Math.random() to get seeding for anything that calls that (including rand-nth
etc.).
@UUSQUGUF3 Looks promising, i'll check it out