# Setting alpha for a point in HSB mode

**URL:** <https://discourse.processing.org/t/setting-alpha-for-a-point-in-hsb-mode/34959>\
**Category:** Beginners\
**Created:** [February 3, 2022, 4:49pm UTC](https://discourse.processing.org/t/setting-alpha-for-a-point-in-hsb-mode/34959 "2022-02-03T16:49:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![goldorak](https://avatars.discourse-cdn.com/v4/letter/g/dec6dc/32.png) [@goldorak](https://discourse.processing.org/u/goldorak)\
**Post date:** [February 3, 2022, 4:49pm UTC](https://discourse.processing.org/t/setting-alpha-for-a-point-in-hsb-mode/34959/1 "2022-02-03T16:49:23Z")

</div>

Hi,

I’m trying to change randomly the alpha setting of a point.  
Here is a summary of my code

```auto
 strokeWeight(10);
  c = color(0,0,0);
  c.setAlpha(random(10));
  stroke(c);
  point(i,j);

```

I can’t get any kind of graduation in my alpha it’s either full black or nothing at all

---

<div class="post-metadata">

**Author:** ![KumuPaul](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kumupaul/32/13072_2.png) [@KumuPaul](https://discourse.processing.org/u/KumuPaul)\
**Post date:** [February 4, 2022, 12:57am UTC](https://discourse.processing.org/t/setting-alpha-for-a-point-in-hsb-mode/34959/2 "2022-02-04T00:57:54Z")

</div>

the default alpha range for HSB mode is 0 to 1 instead of 0 to 100 for the S and B channels:

> Setting colorMode(HSB) lets you use the HSB system instead. By default, this is colorMode(HSB, 360, 100, 100, 1).

so you’ll want to use `c.setAlpha(random(1))`
