# Color alpha method always returns 255

**URL:** <https://forums.sketchup.com/t/color-alpha-method-always-returns-255/130114>\
**Category:** Ruby API\
**Tags:** bug\
**Created:** [July 2, 2020, 1:05pm UTC](https://forums.sketchup.com/t/color-alpha-method-always-returns-255/130114 "2020-07-02T13:05:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MattiaBressanelli](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/mattiabressanelli/32/95664_2.png) [@MattiaBressanelli](https://forums.sketchup.com/u/MattiaBressanelli)\
**Post date:** [July 2, 2020, 1:05pm UTC](https://forums.sketchup.com/t/color-alpha-method-always-returns-255/130114/1 "2020-07-02T13:05:09Z")

</div>

I’m using the Ruby API in SketchUp Pro 2020. When calling the alpha method for Color the result is always 255, even if opacity is set to transparent in the material properties.

Here the example command:  
Sketchup.active\_model.materials[“Material”].color.alpha

Is it a bug or I’m not using it correctly?

---

<div class="post-metadata">

**Author:** ![Fredo6](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/fredo6/32/77024_2.png) [@Fredo6](https://forums.sketchup.com/u/Fredo6)\
**Post date:** [July 2, 2020, 1:39pm UTC](https://forums.sketchup.com/t/color-alpha-method-always-returns-255/130114/2 "2020-07-02T13:39:53Z")

</div>

I think the transparency is set in the material itself.

So `Sketchup.active_model.materials[“Material”].alpha` should give you the value (between 0 and 1)

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [July 2, 2020, 3:10pm UTC](https://forums.sketchup.com/t/color-alpha-method-always-returns-255/130114/3 "2020-07-02T15:10:46Z")

</div>

> [@MattiaBressanelli](#):
>
> Is it a bug or I’m not using it correctly?

The latter. Although the docs don’t state it, Color object alpha transparency is for use with Color by Layer / Tag style only.

---

<div class="post-metadata">

**Author:** ![MattiaBressanelli](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/mattiabressanelli/32/95664_2.png) [@MattiaBressanelli](https://forums.sketchup.com/u/MattiaBressanelli)\
**Post date:** [July 2, 2020, 3:36pm UTC](https://forums.sketchup.com/t/color-alpha-method-always-returns-255/130114/4 "2020-07-02T15:36:13Z")

</div>

Thanks to both of you. Solved and understood 😄
