# How to insert colourMode()s into stroke and fill

**URL:** <https://discourse.processing.org/t/how-to-insert-colourmode-s-into-stroke-and-fill/6049>\
**Category:** Coding Questions\
**Created:** [November 28, 2018, 9:11pm UTC](https://discourse.processing.org/t/how-to-insert-colourmode-s-into-stroke-and-fill/6049 "2018-11-28T21:11:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![CowPieForever](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@CowPieForever](https://discourse.processing.org/u/CowPieForever)\
**Post date:** [November 28, 2018, 9:11pm UTC](https://discourse.processing.org/t/how-to-insert-colourmode-s-into-stroke-and-fill/6049/1 "2018-11-28T21:11:13Z")

</div>

Sorry if this is a dumb question, I’m pretty new at this. I would like to insert different [colourMode()s](https://processing.org/reference/colorMode_.html) into the actual stroke and fill command of a specific shape. How can I do this? Following the instructions on the page just gives me a square of that colour in the top left corner of my window. Thanks.

---

<div class="post-metadata">

**Author:** ![jb4x](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jb4x/32/789_2.png) [@jb4x](https://discourse.processing.org/u/jb4x)\
**Post date:** [November 28, 2018, 9:16pm UTC](https://discourse.processing.org/t/how-to-insert-colourmode-s-into-stroke-and-fill/6049/2 "2018-11-28T21:16:43Z")

</div>

Hi,

What do you mean by inserting different color mode to a stroke ?

A color mode is a way to “classify” the colors. With RGB this is done by giving 3 numbers: the red intensity, the green intensity and the blue intensity. It is good for computer since they are using red, green and blue pixels but not really good for us human. So we created other ways to sort colors that would speak a bit more to us. This is the case for HSB for example where a color is determined by the hue (the color), the saturation (how intense the color looks) and the brightness (how white or dark it is).

You can’t use several one for a stroke. You just decide which langage you want to speak but you can’t speak several at the same time.

If what you mean is give the user the possibility to choose either the RGB values or the HSB values, then you need to look online for some conversion formulas.

---

<div class="post-metadata">

**Author:** ![CowPieForever](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@CowPieForever](https://discourse.processing.org/u/CowPieForever)\
**Post date:** [November 28, 2018, 9:57pm UTC](https://discourse.processing.org/t/how-to-insert-colourmode-s-into-stroke-and-fill/6049/3 "2018-11-28T21:57:32Z")

</div>

I’m seeing how I went wrong with my explanation, but I would like to get the actual gradient colours used in those lines of code. I mistook the colourMode() for the actual code to insert the colour.

I would just like to figure how to actual insert the gradients, that are seen under the colourMode(), into the shapes that are being drawn

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [December 5, 2018, 5:43am UTC](https://discourse.processing.org/t/how-to-insert-colourmode-s-into-stroke-and-fill/6049/4 "2018-12-05T05:43:06Z")

</div>

Were you able to resolve this issue? There are a number of ways to approach this problem – including with vertex coloring in PShape, with a PShader, or with a image mask.

> **[Color Gradients in Processing (v 2.0)](https://behreajj.medium.com/color-gradients-in-processing-v-2-0-e5c0b87cdfd2)**
>
> This tutorial on color gradients is an overhaul of a prior version; hopefully it will prove more useful to creative coders who wish to work…

> [@How to do this kind of gradient on shapes](https://discourse.processing.org/t/how-to-do-this-kind-of-gradient-on-shapes/799):
>
> here are bunch of shapes floating here and there. so i need to apply this kind of a gradient on them. can anyone tell me how to do these kind of thing will be appreciated. Here is the SS: Many Thanks! blush -scoopz

> **[Processing 2.x and 3.x Forum](https://forum.processing.org/two/discussion/21891/gradient-fill-pshape)**
>
> Processing is an electronic sketchbook, a language and a worldwide community. This is its forum.
