# Vega with conditionnal coloring depending on filter

**URL:** <https://discuss.elastic.co/t/vega-with-conditionnal-coloring-depending-on-filter/324205>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [January 30, 2023, 9:22am UTC](https://discuss.elastic.co/t/vega-with-conditionnal-coloring-depending-on-filter/324205 "2023-01-30T09:22:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vincent2mots](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vincent2mots/32/55226_2.png) [@vincent2mots](https://discuss.elastic.co/u/vincent2mots)\
**Post date:** [January 30, 2023, 9:22am UTC](https://discuss.elastic.co/t/vega-with-conditionnal-coloring-depending-on-filter/324205/1 "2023-01-30T09:22:23Z")

</div>

Hi there!

I'm not an expert in Vega language but I would like to make a visualization which background color would depend on the filter in the dashboard.

Let's say I have a Vega with a text and a background color. If a user choose a filter in the dashboard, I would like to change the background color.

I don't know if it's possible with that kind of visualization?

Best regards,

---

<div class="post-metadata">

**Author:** ![vincent2mots](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vincent2mots/32/55226_2.png) [@vincent2mots](https://discuss.elastic.co/u/vincent2mots)\
**Post date:** [February 2, 2023, 6:27pm UTC](https://discuss.elastic.co/t/vega-with-conditionnal-coloring-depending-on-filter/324205/2 "2023-02-02T18:27:16Z")

</div>

For instance, I have this markdown code :

```auto
{
  "$schema": "https://vega.github.io/schema/vega/v3.json",
  "autosize": "true"
  "background": "#234990",
  "padding": 5,
  "marks": [
    {
      "type": "text",
      "encode": {
        "update": {
          "text": { "value": "MY TEXT" },
          "align": { "value": "center"},
          "baseline": { "value": "line-bottom"},
          "stroke": { "value": "#FFFFFF" },
          "angle": { "value": 0 },
          "x": { "signal": "width/2" },
          "y": { "signal": "height/2.3" }
        }
      }
    }
  ]
}

```

It would be great I could change the background color depending on what filters I have on my dashboard level.

Would you think it's possible?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 2, 2023, 6:27pm UTC](https://discuss.elastic.co/t/vega-with-conditionnal-coloring-depending-on-filter/324205/3 "2023-03-02T18:27:40Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
