You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently style() method can be used like this: style(property) and style(property, value) and style('property1: value1; property2: value2')
Using style() like this becomes inefficient if we want to have a relatively large number of styles.
Solution:
If we add a functionality that enables style() to accept an object with styles defined in it, it would reduce a lot of work and make it more efficient and easy to use.
let styles, div;
function setup(){
background(220);
div = createDiv('text');
//object which contains styles
styles = {
color: green;
background: white;
boxShadow: 0 3px 5px black;
width: 50%;
margin: 0 auto;
};
div.style(styles);
}
There is also a workaround for this which is using string template literals to define styles.
Example here
In this case, we can update the inline docs by adding an example.
Most appropriate sub-area of p5.js?
Accessibility (Web Accessibility)
Build tools and processes
Color
Core/Environment/Rendering
Data
DOM
Events
Friendly error system
Image
IO (Input/Output)
Localization
Math
Unit Testing
Typography
Utilities
WebGL
Other (specify if possible)
Feature enhancement details:
The text was updated successfully, but these errors were encountered:
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.
I'm not sure the accessibility requirement for new features has been met here. One thing I would consider is this new way of defining style makes things easier but for whom?
I think you are right, this feature doesn't quite fulfill the established p5.js access criteria. I thought having this feature would help in writing cleaner, understandable (if we are defining a lot of styles) and quality code. This would make the above things easier for all the p5.js users in general.
I also think having this feature would open doors to make p5.js and DOM much more connected like having CSS properties and states (hover, active, etc. which currently using p5.js is not easy to implement), taking p5.js DOM to a whole new level.
These are great ideas @Aloneduckling, but I agree with your assessment about access criteria. I'd propose we table this for now and see if further needs develop.
Uh oh!
There was an error while loading. Please reload this page.
How would this new feature help increase access to p5.js?
Currently style() method can be used like this:
style(property)
andstyle(property, value)
andstyle('property1: value1; property2: value2')
Using
style()
like this becomes inefficient if we want to have a relatively large number of styles.Solution:
If we add a functionality that enables style() to accept an object with styles defined in it, it would reduce a lot of work and make it more efficient and easy to use.
There is also a workaround for this which is using string template literals to define styles.
Example here
In this case, we can update the inline docs by adding an example.
Most appropriate sub-area of p5.js?
Feature enhancement details:
The text was updated successfully, but these errors were encountered: