You can also use the shorthand form of these colors by dropping the carbon--
namespace:
$blue-50;
$cool-gray-10;
$black-100;
$white-0;
Note: the shorthand variables require that you do not have any other
conflicting variables in your setup. Namespaced variables are always preferred
for this reason, unless you are confident that no collisions will occur.
If you would like you choose when these variables are defined, then you can call
the carbon--colors mixin directly by importing the following file:
Alongside the color variables detailed above, we also provide a map of colors so
that you can programmatically use these values. This map is called
$carbon--colors and each key is the name of a swatch. The value of these
swatches is also a map, but each key is now the grade. In code, this looks like
the following:
You can include this variable by including @carbon/colors/scss/colors or
calling the carbon--colors() mixin directly.
Migrating from previous versions
If you were originally using a project that had color variables defined as
$ibm-color__<swatch>-<grade>, or are relying on $ibm-color-map, you can also
use the entrypoint described above to access these colors. They are meant as an
easier way to help adopt these packages. However, these variables will be
removed in the next release of Carbon.
Similar to previous efforts, we also provide colors in the formats mentioned
above. For example:
$ibm-color__blue-50;
$ibm-color__warm-gray-100;
If you would like a mixin to conditionally include these variables, you can
include the mixin by using:
We're always looking for contributors to help us fix bugs, build new features,
or help us improve the project documentation. If you're interested, definitely
check out our Contributing Guide! 👀
This package uses IBM Telemetry to collect metrics data. By installing this
package as a dependency you are agreeing to telemetry collection. To opt out,
see
Opting out of IBM Telemetry data collection.
For more information on the data being collected, please see the
IBM Telemetry documentation.
Colors for digital and software products using the Carbon Design System
The npm package @carbon/colors receives a total of 96,613 weekly downloads. As such, @carbon/colors popularity was classified as popular.
We found that @carbon/colors demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 9 open source maintainers collaborating on the project.
Package last updated on 13 Mar 2024
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.