# Unicorn HAT/pHAT - brightness setting on individual LEDs

**URL:** <https://forums.pimoroni.com/t/unicorn-hat-phat-brightness-setting-on-individual-leds/3384>\
**Category:** Support\
**Created:** [November 22, 2016, 4:36pm UTC](https://forums.pimoroni.com/t/unicorn-hat-phat-brightness-setting-on-individual-leds/3384 "2016-11-22T16:36:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Plony\_Almony](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@Plony\_Almony](https://forums.pimoroni.com/u/Plony_Almony)\
**Post date:** [November 22, 2016, 4:36pm UTC](https://forums.pimoroni.com/t/unicorn-hat-phat-brightness-setting-on-individual-leds/3384/1 "2016-11-22T16:36:33Z")

</div>

I’d like to be able to control the brightness setting on individual LEDs. I know you can do this on the PiGlow, but is there way to do this on the Unicorn HAT and Unicorn pHAT?

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [November 23, 2016, 11:57am UTC](https://forums.pimoroni.com/t/unicorn-hat-phat-brightness-setting-on-individual-leds/3384/2 "2016-11-23T11:57:38Z")

</div>

Internally, all the brightness really does is scale down your colour values accordingly. You can do this manually quite easily.

Imagine you set a pixel to full white, that’s RGB `255, 255, 255`. If brightness is set to 50% then internally it will write `128,128,128` to the Unicorn HAT.

You can scale your own colours in the same way. Something like:

```python
r, g, b = 128, 255, 78
brightness = 0.2
r, g, b = [int(x * brightness) for x in (r, g, b)]

```

---

<div class="post-metadata">

**Author:** ![Plony\_Almony](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@Plony\_Almony](https://forums.pimoroni.com/u/Plony_Almony)\
**Post date:** [November 23, 2016, 5:23pm UTC](https://forums.pimoroni.com/t/unicorn-hat-phat-brightness-setting-on-individual-leds/3384/3 "2016-11-23T17:23:15Z")

</div>

Thanks! That suggestion helped make my program do what I wanted it to do.
