# כיצד לשנות פריט CSS בהתבסס על מצב כהה או בהיר?

**URL:** <https://meta.discourse.org/t/how-to-change-css-item-based-on-dark-or-light-mode/268631>\
**Category:** Development\
**Created:** [16 ביוני,‏ 2023,‏ 2:14pm UTC](https://meta.discourse.org/t/how-to-change-css-item-based-on-dark-or-light-mode/268631 "2023-06-16T14:14:54Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![manuel](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/manuel/32/468169_2.png) [@manuel](https://meta.discourse.org/u/manuel)\
**Post date:** [18 ביוני,‏ 2023,‏ 6:20pm UTC](https://meta.discourse.org/t/how-to-change-css-item-based-on-dark-or-light-mode/268631/10 "2023-06-18T18:20:49Z")

</div>

> [@Lilly](#):
>
> i’m going to mess around with it today and see if i can come up with dark - light mode css conditional. i feel like this should be possible.

I’d love to be proven wrong on this, but I think there’s no reliable check you could use with css.

@sp-jordan-violet usually the way to go is to use color variables from your dark and light color schemes. You can check your current values using the browser inspector. I believe you can’t add new variables that will switch depending on color scheme. But there’s quite a lot of variables to pick from and you can use them in any custom declaration. E.g

```plaintext
.topic-avatar {
  height: unset;
  align-self: stretch;
  background-image: linear-gradient(
      to right,
      transparent -40%,
      var(--secondary) 80%
    ),
    linear-gradient(
      to bottom,
      var(--tertiary-300) 0%,
      var(--highlight) 50%,
      var(--quaternary-low) 100%
    );
}

```

could give you a post highlight like this 🌈🙂

 ![image](https://global.discourse-cdn.com/meta/original/4X/0/6/6/06692dea844904fa66b91776a1bf2b14c5c908f7.png)

---

_[View the full topic](https://meta.discourse.org/t/how-to-change-css-item-based-on-dark-or-light-mode/268631)._
