p5.js icon indicating copy to clipboard operation
p5.js copied to clipboard

push() ignores the _colorMaxes field set by colorMode()

Open zeesworth opened this issue 1 year ago • 8 comments

Most appropriate sub-area of p5.js?

  • [ ] Accessibility
  • [X] Color
  • [X] Core/Environment/Rendering
  • [ ] Data
  • [ ] DOM
  • [ ] Events
  • [ ] Image
  • [ ] IO
  • [ ] Math
  • [ ] Typography
  • [ ] Utilities
  • [ ] WebGL
  • [ ] Build process
  • [ ] Unit testing
  • [ ] Internationalization
  • [ ] Friendly errors
  • [ ] Other (specify if possible)

p5.js version

v1.11.0

Web browser and version

Firefox 128.5.1esr

Operating system

Windows 10

Steps to reproduce this

Steps:

  1. Call push()
  2. Call colorMode() with a non-default max color value
  3. Call pop(), all color calls after that will still continue to use the max color values specified in the push() section

Snippet:

function draw() {
  colorMode(RGB, 1.0); 
  background(0.5);
  
  push();
  //colorMode(RGB, 0.5); // Uncomment me for fun and bugs
  pop();
  
  textSize(32);
  fill(0.5);
  text('Oh no', 50, 50);
}

zeesworth avatar Dec 01 '24 06:12 zeesworth

Welcome! šŸ‘‹ Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms. Thank you!

welcome[bot] avatar Dec 01 '24 06:12 welcome[bot]

Looking at the code responsible for push(), it seems like it would be a very simple change to make the function hold onto the value of _colorMaxes too. I would be happy to submit a change that fixes this bug, if this is considered an issue.

zeesworth avatar Dec 01 '24 06:12 zeesworth

Hi @zeesworth , I’m interested in working on this issue. Could you please assign it to me ?

mahi6299 avatar Dec 14 '24 07:12 mahi6299

I'm not an admin of the repository so I'm not able to do that sadly

zeesworth avatar Dec 14 '24 13:12 zeesworth

Can I work on this issue?

Rishab87 avatar Dec 21 '24 08:12 Rishab87

@perminder-17 As there is inactivity, can I work on this?

swastikCommits avatar Mar 01 '25 02:03 swastikCommits

@mahi6299 are you still working on it? Let me know if you have any doubts :)

perminder-17 avatar Mar 01 '25 05:03 perminder-17

No, I'm not working

mahi6299 avatar Mar 01 '25 07:03 mahi6299