Skip to content
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

Change Reference Example #7280

Merged

Conversation

samarsrivastav
Copy link
Contributor

Resolves #7228

Changes:

change #7228

Screenshots of the change:

Copy link

welcome bot commented Sep 22, 2024

🎉 Thanks for opening this pull request! Please check out our contributing guidelines if you haven't already. And be sure to add yourself to the list of contributors on the readme page!

@Qianqianye
Copy link
Contributor

Thanks @samarsrivastav for working on it. Tagging @aleannab and @davepagurek to review this PR.

@perminder-17 perminder-17 self-requested a review September 25, 2024 21:43
Copy link
Contributor

@perminder-17 perminder-17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @samarsrivastav for your work, it's a great work and thanks @aleannab for rasing and explaing the issue with solution. What I feel the sketch @aleannab mentioned has only used two colors for all the types of blendMode. They are #1a85ff and #d41159.

However in the examples if I do grunt yui:dev I can see the noticable difference with the examples.

image

image

What I see that you have used the set of colors from here: (in the refrence) which is actually the resultant colors. :")

image

We can fix this by using the appropriate colors ('#1a85ff' and '#d41159') for them, and can add other blendModes which are removed i.e. "ADD" and "DARKEST" (with different color sets). Otherwise looks good. :)

*
* // Set the blend mode.
* blendMode(ADD);
* blendMode(HARD_LIGHT);
Copy link
Contributor

@perminder-17 perminder-17 Sep 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that you removed two example sketches:

  1. blendMode(ADD)
  2. blendMode(DARKEST)

I think we could keep these examples. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @perminder-17 !! I have added these two as well, is there any sort of order we need to follow while adding all the blendmodes?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @perminder-17 !! I have added these two as well, is there any sort of order we need to follow while adding all the blendmodes?

No, i don't think so. Its just that we need to help users learn about blendMode() so it could be in any order.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

@@ -728,7 +728,7 @@ p5.prototype.clearDepth = function(depth) {
* final color results from blending the source pixel's color with the canvas
* pixel's color. RGB color values from the source and canvas pixels are
* compared, added, subtracted, multiplied, and divided to create different
* effects. Red values with red values, greens with greens, and blues with
* effects. #d41159 values with #d41159 values, greens with greens, and blues with
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this stay red, as this statement refers to the color channels, not the color of the line?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

* line(75, 25, 25, 75);
*
* describe('A blue line and a red line form an X on a gray background.');
* describe('A #1a85ff line and a #d41159 line form an X on a gray background.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to be more screen reader-accessible, I suggest we are more descriptive with the new color values instead of using hex codes like #d41159. For example, here we could say "A vibrant pink line and a bright blue line..."

This comment would be applicable to all the describe statements for the blend mode examples.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @aleannab, I completely understand the need to use color names, but I’m a bit uncertain about the best way to name these specific colors. Could you provide some guidance on how to approach this? I’d really appreciate your help!

@aleannab
Copy link
Contributor

aleannab commented Sep 26, 2024

What I see that you have used the set of colors from here: (in the refrence)

Ah, yes, in the original reference I used '#1a85ff' and '#d41159' for all the examples.

The colors in the table are the resulting colors after the blend mode has been applied. I provided those to highlight the differences in the before and after.

Here's example of how I generated the reference images:
https://editor.p5js.org/aleannab/sketches/r4VWTS7Cr

This is how the end results should show, as I mentioned in the original issue.
364639172-48914d38-0ea5-46f0-a83f-84bf7f11bc94

@perminder-17
Copy link
Contributor

What I see that you have used the set of colors from here: (in the refrence)

Ah, yes, in the original reference I used '#1a85ff' and '#d41159' for all the examples.

The colors in the table are the resulting colors after the blend mode has been applied. I provided those to highlight the differences in the before and after.

Here's example of how I generated the reference images: https://editor.p5js.org/aleannab/sketches/r4VWTS7Cr

Aaah...yess. I see, I think currently we are using the resulting colors rather than the colors you mentioned in the refrence i.e. '#1a85ff' and '#d41159'. We should use these colors only rather than resulting one. I just now noticed in the issue haha. Thanks @aleannab I'll now edit my review so that @samarsrivastav could work on it. Thanks:)

@aleannab
Copy link
Contributor

aleannab commented Sep 26, 2024

What I see that you have used the set of colors from here: (in the refrence)

Ah, yes, in the original reference I used '#1a85ff' and '#d41159' for all the examples.
The colors in the table are the resulting colors after the blend mode has been applied. I provided those to highlight the differences in the before and after.
Here's example of how I generated the reference images: https://editor.p5js.org/aleannab/sketches/r4VWTS7Cr

Aaah...yess. I see, I think currently we are using the resulting colors rather than the colors you mentioned in the refrence i.e. '#1a85ff' and '#d41159'. We should use these colors only rather than resulting one. I just now noticed in the issue haha. Thanks @aleannab I'll now edit my review so that @samarsrivastav could work on it. Thanks:)

Kind of along the same note: I think we should change the REPLACE, REMOVE, and SUBTRACT examples to use these colors as well. The only reason why I didn't include it in my original reference was because I could only use these in WEBGL mode (and others only in 2D mode).

@perminder-17
Copy link
Contributor

Kind of along the same note: I think we should change the REPLACE, REMOVE, and SUBTRACT examples to use these colors as well. The only reason why I didn't include it in my original reference was because I could only use these in WEBGL mode (and others only in 2D mode).

Yes, sure thing. I checked these three modes too, and the colors you mentioned work great.

@samarsrivastav
Copy link
Contributor Author

Hey @perminder-17 and @aleannab, I've resolved the color issue and added the colors as per the example provided here. However, I'm still uncertain about how to best name these colors. I'd appreciate any guidance you can offer on the naming part!

@samarsrivastav
Copy link
Contributor Author

I’ve used an AI assistant to generate color names for my reference. Could you please take a look and let me know your thoughts?

 blendModes = [
  {
    blendMode: 'BLEND',
    description: 'A dodgerblue line and a cerise line form an X on a gray background.'
  },
  {
    blendMode: 'HARD_LIGHT',
    description: 'A faint dodgerblue line and a faint cerise line form an X on a gray background. The area where they overlap is purple.'
  },
  {
    blendMode: 'ADD',
    description: 'A faint dodgerblue line and a faint cerise line form an X on a gray background. The area where they overlap is purple.'
  },
  {
    blendMode: 'DARKEST',
    description: 'A faint dodgerblue line and a faint cerise line form an X on a gray background. The area where they overlap is purple.'
  },
  {
    blendMode: 'BURN',
    description: 'A dodgerblue line and a cerise line form an X on a gray background. The area where they overlap is black.'
  },
  {
    blendMode: 'LIGHTEST',
    description: 'A faint dodgerblue line and a faint cerise line form an X on a gray background. The area where they overlap is lavender.'
  },
  {
    blendMode: 'EXCLUSION',
    description: 'A dodgerblue line and a cerise line form an X on a gray background. The area where they overlap is greenish-gray.'
  },
  {
    blendMode: 'MULTIPLY',
    description: 'A dodgerblue line and a cerise line form an X on a gray background. The area where they overlap is very dark blue.'
  },
  {
    blendMode: 'SCREEN',
    description: 'A faint dodgerblue line and a faint cerise line form an X on a gray background. The area where they overlap is very light lavender.'
  },
  {
    blendMode: 'REPLACE',
    description: 'A diagonal cerise line.'
  },
  {
    blendMode: 'REMOVE',
    description: 'The silhouette of an X is missing from a gray background.'
  },
  {
    blendMode: 'DIFFERENCE',
    description: 'A dodgerblue line and a cerise line form an X on a gray background. The area where they overlap is dark brown.'
  },
  {
    blendMode: 'OVERLAY',
    description: 'A faint dodgerblue line and a faint cerise line form an X on a gray background. The area where they overlap is medium purple.'
  },
  {
    blendMode: 'SOFT_LIGHT',
    description: 'A faint dodgerblue line and a faint cerise line form an X on a gray background. The area where they overlap is lavender gray.'
  },
  {
    blendMode: 'DODGE',
    description: 'A faint dodgerblue line and a faint cerise line form an X on a gray background. The area where they overlap is pale lavender.'
  },
  {
    blendMode: 'SUBTRACT',
    description: 'A dodgerblue line and a cerise line form an X on a gray background. The area where they overlap is black.'
  }
];

@perminder-17
Copy link
Contributor

Hey @perminder-17 and @aleannab, I've resolved the color issue and added the colors as per the example provided here.

hey, thanks. Looks correct.

I'd appreciate any guidance you can offer on the naming part!

Yes, in my opinion, if you're referring to the color dodgerblue, its color code is #1E90FF, which is very similar to the color you used in the sketch (i.e. #1a85ff). However, these are not the exact same colors, and the color you used in the sketch doesn't have an official name currently :"(

We could just use the color code in the discription saying for eg.

  {
    blendMode: 'BLEND',
    description: 'A `#1a85ff` line and a `#d41159` line form an X on a gray background.'
  },

similarly for other colors, we can say,

{
    blendMode: 'DODGE',
    description: 'A `#c8ffff` (from the image shared below) and a `ffc1ff` line form an X on a gray background. 
                 The area where they overlap is (the results after calculations).' // need to calculate the overlap color
  },

To find the exact colors (resultant) that we get after blending, here are the final colors produced.

image

The reasons I'm not focusing on the color names are:

  1. Some types look exactly the same—for example, "ADD" and "DODGE"—and we can distinguish them by their color codes.
  2. Including names that have different color codes in the description could confuse users.

For calculating the exact colors overlapped, you can calculate from the formulas
https://github.com/pdaoust/stylus-helpers/blob/master/blend.styl
or
https://en.wikipedia.org/wiki/Blend_modes

Or you may use ai for the calculations, since it's probably very good at calculations haha. Let me know what are your thoughts.

@perminder-17
Copy link
Contributor

One last thought: as @aleannab mentioned, can we use the same two colors, (1a85ff and d41159), in the blendMode(SUBTRACT)? I believe you're currently using blue and red, correct?

@aleannab
Copy link
Contributor

We could just use the color code in the discription saying for eg.

  {
    blendMode: 'BLEND',
    description: 'A `#1a85ff` line and a `#d41159` line form an X on a gray background.'
  },

similarly for other colors, we can say,

{
    blendMode: 'DODGE',
    description: 'A `#c8ffff` (from the image shared below) and a `ffc1ff` line form an X on a gray background. 
                 The area where they overlap is (the results after calculations).' // need to calculate the overlap color
  },


The reasons I'm not focusing on the color names are:

    1. Some types look exactly the same—for example, "ADD" and "DODGE"—and we can distinguish them by their color codes.

    2. Including names that have different color codes in the description could confuse users.


For calculating the exact colors overlapped, you can calculate from the formulas https://github.com/pdaoust/stylus-helpers/blob/master/blend.styl or https://en.wikipedia.org/wiki/Blend_modes

Or you may use ai for the calculations, since it's probably very good at calculations haha. Let me know what are your thoughts.

I also agree that the exact color names aren't super important. However, considering that the describe function is for screen reader accessibility for blind or visually impaired users to read the text, I think that having semi-descriptive color names (e.g. pale blue vs. aqua) are more useful than hex codes. It does get tricky though since many of the colors do look similar.

Maybe one of the Accessibility Stewards can weigh in with their thoughts? @Qianqianye @calebfoss, @cosmicbhejafry, @apoorva-a98, @tedkmburu, @Zarkv, @SkylerW99, @itsjoopark, @hannahvy, @nhasalajoshi

@aleannab
Copy link
Contributor

One last thought: as @aleannab mentioned, can we use the same two colors, (1a85ff and d41159), in the blendMode(SUBTRACT)? I believe you're currently using blue and red, correct?

Ah, I was using the same two colors (1a85ff and d41159) across the board. I agree that makes sense!

@samarsrivastav
Copy link
Contributor Author

Certainly! I will ensure that the same colors are used consistently across all blend mode examples.

One final clarification I’d like to make, regarding the issue:

  1. We are using the colors #1a85ff and #d41159 for the blend mode.
  2. However, when describing them, we are referencing the color names from the table provided above.

@aleannab and @perminder-17, please give a thumbs up if you feel this is the approach, and I will proceed with committing the changes.

@aleannab
Copy link
Contributor

aleannab commented Sep 26, 2024

Certainly! I will ensure that the same colors are used consistently across all blend mode examples.

One final clarification I’d like to make, regarding the issue:

1. We are using the colors #1a85ff and #d41159 for the blend mode.

2. However, when describing them, we are referencing the color names from the table provided above.

@aleannab and @perminder-17, please give a thumbs up if you feel this is the approach, and I will proceed with committing the changes.

Thanks @samarsrivastav ! Thumbs up to the first item! Let's wait on the color names for describe() until one of the Accessibility stewards can give their opinion.

@perminder-17
Copy link
Contributor

perminder-17 commented Sep 26, 2024

Thanks @samarsrivastav ! Thumbs up to the first item! Let's wait on the color names for describe() until one of the Accessibility stewards can give their opinion.

Sounds good!

@davepagurek
Copy link
Contributor

Hi! I'm not an accessibility steward, but assuming the descriptions are intended for humans using screen readers, we probably should be using some kind of human-readable color in the description. Ideally we've picked input colors that make the visual differences between e.g. ADD and DODGE different enough that we can describe them as something like "blue" vs "lighter blue", but since that sounds hard to achieve across the board, I think it's ok if not all the described colours are distinct from each other.

@perminder-17
Copy link
Contributor

Thanks for the response @davepagurek

  1. However, when describing them, we are referencing the color names from the table provided above.

I think you can go with the naming instead of the codes in order to describe them. @samarsrivastav .

Thanks for your work.

@aleannab
Copy link
Contributor

aleannab commented Sep 26, 2024

Thank you @davepagurek and @perminder-17! If this helps, @samarsrivastav , I have the following table (with ChatGPT doing the heavy lifting). Feel free to make adjustments as you see fit. I gave ChatGPT the image I posted in the original issue.

Blend Mode Colors Overlapped
BLEND Sky Blue (#1a85ff) and Deep Rose (#d41159) no overlap
HARD_LIGHT Ocean Blue (#25b7ff) and Hot Pink (#e6187e) Magenta Purple (#b518b2)
BURN Cobalt Blue (#006fb4) and Burgundy (#a50028) Black (#.000028)
MULTIPLY Slate Blue (#125eb4) and Plum (#96187e) Dark Indigo (#0f063f)
DARKEST Steel Blue (#1a85b4) and Cranberry (#b41159) Deep Purple (#1a1159)
SOFT_LIGHT Pale Sky (#8ab6d6) and Rose Blush (#cb86a4) Lavender (#ab89cc)
LIGHTEST Pale Lavender (#b4b4ff) and Soft Beige (#d4b4b4) Pale Lilac (#d4b4ff)
SCREEN Baby Blue (#bcdbff) and Peach Pink (#f2b9ce) Misty Lilac (#f4ddff)
ADD Icy Blue (#ceffff) and Light Lavender (#ffc5ff) White (#ffffff)
DODGE Aqua Blue (#c8ffff) and Light Pink (#ffc1ff) White (#ffffff)
OVERLAY Cornflower Blue (#78b7ff) and Light Rose (#e6739d) Violet (#c879ff)
DIFFERENCE Light Burgundy (#9a2f4b) and Forest Green (#20a35b) Dark Cocoa (#3a1e0e)
EXCLUSION Earthy Brown (#a97d4b) and Muted Sage (#5dad8f) Sage Green (#647d70)
SUBTRACT Burnt Orange (#ae4300) and Sea Green (#00b76f) Forest Green (#.003200)
REMOVE Transparent X
REPLACE Only draws the last item drawn, line is Deep Rose (#d41159)

@perminder-17
Copy link
Contributor

Thank you @davepagurek and @perminder-17! If this helps, @samarsrivastav , I have the following table (with ChatGPT doing

Looks awesome. Thanks:)

@samarsrivastav
Copy link
Contributor Author

@perminder-17 and @aleannab, I have committed the changes. Kindly review them and share your feedback at your earliest convenience.

Copy link
Contributor

@aleannab aleannab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @samarsrivastav! This is extremely nit-picky, but there's inconsistency throughout regarding capitalization of color names. Following the format of the original example, all colors should be lowercase, unless it's at the start of a sentence. If @perminder-17 doesn't see anything else, I think we should be good to go!

@@ -812,7 +812,7 @@ p5.prototype.clearDepth = function(depth) {
* stroke('#d41159');
* line(75, 25, 25, 75);
*
* describe('A faint #1a85ff line and a faint #d41159 line form an X on a gray background. The area where they overlap is #B518B2.');
* describe('An Ocean Blue line and a Hot pink line form an X on a gray background. The area where they overlap is Magenta purple.');
Copy link
Contributor

@aleannab aleannab Sep 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is inconsistency in capitalization of color names (e.g. "Ocean Blue" vs. "Hot pink") here, and across all the examples.

Copy link
Contributor

@perminder-17 perminder-17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all colors should be lowercase, unless it's at the start of a sentence

Good catch!

I think we are good to go....could be the last bit only. Thanks.

@@ -1247,7 +1247,7 @@ p5.prototype.blendMode = function(mode) {
* // Draw the circle.
* circle(50, 50, 40);
*
* describe('A fiery sun drawn on a light blue background.');
* describe('A fiery sun drawn on a light #1a85ff background.');
Copy link
Contributor

@perminder-17 perminder-17 Sep 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* describe('A fiery sun drawn on a light #1a85ff background.');
* describe('A fiery sun drawn on a light blue background.');

Maybe the last bit. This change you have made on the drawingContext method. So this can be reverted to it's color name.

@samarsrivastav
Copy link
Contributor Author

@perminder-17, I apologize for the oversight earlier. I've reverted to the original naming and ensured that all color names are now consistently in lowercase.

Copy link
Contributor

@perminder-17 perminder-17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the last bit. Otherwise we are good to go!

src/core/rendering.js Outdated Show resolved Hide resolved
Co-authored-by: Perminder Singh <[email protected]>
Copy link
Contributor

@perminder-17 perminder-17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks for your work @samarsrivastav and thanks for the review @aleannab

Copy link
Contributor

@davepagurek davepagurek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks everyone!

@davepagurek davepagurek merged commit 58a3c24 into processing:main Sep 27, 2024
2 checks passed
@aleannab
Copy link
Contributor

Yay @samarsrivastav! And thank you @perminder-17 and @davepagurek!

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

Successfully merging this pull request may close these issues.

Reference examples for blendMode() need distinct colors to highlight differences
5 participants