Skip to content

adding properties to color object #7767

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 17 tasks
rruubboott opened this issue Apr 22, 2025 · 1 comment
Open
1 of 17 tasks

adding properties to color object #7767

rruubboott opened this issue Apr 22, 2025 · 1 comment

Comments

@rruubboott
Copy link

Increasing access

By simplifying a process, making information more easily accessible by beginners.

Most appropriate sub-area of p5.js?

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

Feature enhancement details

The color object's r,g,b and a values could be accessible via literal properties called r,g,b,a (or at a push red, green,blue etc.)
So that is to say you could get access to the Red value of a color object via:
color.r or color.red
and not have to go into:
color.levels[0]

@LalitNarayanYadav
Copy link
Contributor

This is a great idea—accessing color components directly via color.r, color.g, color.b, and color.a would definitely make the API more intuitive, especially for beginners. It improves readability and aligns well with p5.js’s focus on accessibility and simplicity.

Relevant sub-areas: Color, Accessibility.

I'd be happy to contribute to this! Could you please point me to the relevant file(s) or location in the codebase where this change should be made?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants