Skip to content

P3 Color Support #823

Answered by peduarte
derekr asked this question in Help
Oct 1, 2021 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Hey, how about this:

import { createStitches } from "@stitches/react";

/**
 * What's happening:
 * 1. We define a `brightGreen` token with the "normal green"
 * 2. This token will be created as a CSS Custom Property: `colors-brightGreen`
 * 3. We then use the `globalCss` function to override the CSS Custom Property under a `@supports` rule
 * The reason for doing it this way is so you still get the token suggestion!
 */

const { styled, globalCss } = createStitches({
  theme: {
    colors: {
      // Define token (normal green)
      brightGreen: "rgb(0, 255, 0)"
    }
  }
});

const globalStyles = globalCss({
  // Target the `:root`
  ":root": {
    // Check for support
    "@supports (…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@peduarte
Comment options

@derekr
Comment options

Answer selected by derekr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants