Re: [csswg-drafts] [css-values] random() function

In my previous musings on the topic, I stated that there are two ways we can evaluate random(), both of which are useful:

1. Evaluated once per occurrence in the stylesheet, at parse time.
2. Evaluated once per occurrence in the stylesheet per element, at specified-value time.

The first means that `.foo:hover { color: rgb(random(0, 255), 0, 0); }` evaluates to the same color for every .foo element, and doesn't change if you repeatedly hover/unhover.  The second means it'll be different on each .foo element, but will still be consistent if you repeatedly hover/unhover a given element.

There's possibly a third, even less stable mode: evaluated freshly at "application" time, whenever the rule would trigger a transition due to it winning the cascade over a different specified value.  This is different per element, *and* is different each time you hover the element.

--------

We'd also want a few different types of randomness; numeric ranges are okay, but getting a random value from a list is very useful and handles colors well, too.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2826#issuecomment-401786655 using your GitHub account

Received on Monday, 2 July 2018 12:23:24 UTC