# Alpha vs color

**URL:** <https://discourse.julialang.org/t/alpha-vs-color/59445>\
**Category:** Visualization\
**Tags:** makie\
**Created:** [April 16, 2021, 10:20pm UTC](https://discourse.julialang.org/t/alpha-vs-color/59445 "2021-04-16T22:20:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [April 16, 2021, 10:20pm UTC](https://discourse.julialang.org/t/alpha-vs-color/59445/1 "2021-04-16T22:20:10Z")

</div>

In [this answer](https://discourse.julialang.org/t/stheno-with-makie/58882/2) there is

```julia
band!(x_plot, mea .- st3, mea .+ st3, color = (:blue, 0.2))

```

which makes a transparent band

 ![image](https://global.discourse-cdn.com/julialang/original/3X/f/0/f0b465f88eae0edc8e6dc91a6bbec1b5235496fc.png)

but using `alpha` explicitly doesn’t

```julia
band!(x_plot, mea .- st3, mea .+ st3, color = :blue, alpha=0.2)

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/e/8ea4ca2d9c0b6d010193457f3c733065b7a0da59.png)

- Is the `Tuple{Symbol, Number}` form of `color=` documented?
- Why doesn’t `alpha=` work here?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [April 17, 2021, 12:15am UTC](https://discourse.julialang.org/t/alpha-vs-color/59445/2 "2021-04-17T00:15:47Z")

</div>

Good question if it’s documented, I’m not sure if or where, but basically Makie never uses alpha keywords. You always have to pass colors with alpha channel if you want transparency, and the tuple syntax has a conversion overload to RGBA.

The only problem is that alpha can mean something slightly different, that is an opacity value for one whole layer of drawing operations together. You can’t copy that by assigning each element a half transparent color, think about the stroke and fill of a scatter for example. And Makie doesn’t implement this “layer opacity” at all.

---

<div class="post-metadata">

**Author:** ![FPGro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fpgro/32/20822_2.png) [@FPGro](https://discourse.julialang.org/u/FPGro)\
**Post date:** [April 17, 2021, 8:26am UTC](https://discourse.julialang.org/t/alpha-vs-color/59445/3 "2021-04-17T08:26:22Z")

</div>

Shouldn’t it issue a warning then? Like

```julia
`alpha` keyword is not supported by Makie. Use `color = (:color, alpha)` instead

```

---

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [April 17, 2021, 8:41am UTC](https://discourse.julialang.org/t/alpha-vs-color/59445/4 "2021-04-17T08:41:41Z")

</div>

Fwiw `alpha` and `transparency` both appear at [http://makie.juliaplots.org/stable/generated/plot-attributes.html](http://makie.juliaplots.org/stable/generated/plot-attributes.html).

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [June 18, 2021, 11:06am UTC](https://discourse.julialang.org/t/alpha-vs-color/59445/5 "2021-06-18T11:06:05Z")

</div>

How do I set the alpha while retaining the ability to autocycle through the color palette? E.g. when doing

```julia
lines(rand(10))
lines!(rand(10))
current_figure()

```

the lines will automatically have colors 1 and 2 from the currently chosen palette. If to set the alpha value I need to to

```julia
lines(rand(10), color = (:blue, 0.5))
lines!(rand(10), color = (:orange, 0.5))
current_figure()

```

I lose the ability to automatically take from the color palette and need to manually specify colors for each line.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [June 18, 2021, 11:07am UTC](https://discourse.julialang.org/t/alpha-vs-color/59445/6 "2021-06-18T11:07:19Z")

</div>

Hm yeah without an alpha keyword that’s difficult. You could set a palette with alpha maybe? Using `Colors.coloralpha` for example
