@carbon/colors
Advanced tools
Comparing version
{ | ||
"name": "@carbon/colors", | ||
"description": "Colors for digital and software products using the Carbon Design System", | ||
"version": "10.1.1", | ||
"version": "10.2.0", | ||
"license": "Apache-2.0", | ||
@@ -28,13 +28,14 @@ "main": "lib/index.js", | ||
"scripts": { | ||
"build": "yarn clean && bundler bundle src/index.js --name CarbonColors && node tasks/build.js && bundler check 'scss/*.scss' && bundler sassdoc 'scss'", | ||
"build": "yarn clean && bundler bundle src/index.js --name CarbonColors && node tasks/build.js && bundler check 'scss/*.scss' && bundler sassdoc 'scss/*.scss'", | ||
"clean": "rimraf css es lib umd scss" | ||
}, | ||
"devDependencies": { | ||
"@carbon/bundler": "10.1.1", | ||
"@carbon/cli-reporter": "10.0.0", | ||
"@carbon/test-utils": "10.0.0", | ||
"@carbon/bundler": "10.2.0", | ||
"@carbon/cli-reporter": "10.2.0", | ||
"@carbon/scss-generator": "10.2.0", | ||
"@carbon/test-utils": "10.2.0", | ||
"change-case": "^3.0.2", | ||
"core-js": "^3.0.1", | ||
"fs-extra": "^7.0.0", | ||
"node-sass": "^4.11.0", | ||
"prettier": "^1.14.3", | ||
"rimraf": "^2.6.2" | ||
@@ -48,3 +49,3 @@ }, | ||
}, | ||
"gitHead": "0931cfcf4a7636d6e3f5aff3ab8d7d7f2d4ecb99" | ||
"gitHead": "e71825a0cf44f6f41fee7d2b0dd9c57d7bda126a" | ||
} |
# @carbon/colors | ||
> Colors for digital and software products using the Carbon Design | ||
> System | ||
> Colors for digital and software products using the Carbon Design System | ||
## Getting started | ||
To install `@carbon/colors` in your project, you will need to run the | ||
following command using [npm](https://www.npmjs.com/): | ||
To install `@carbon/colors` in your project, you will need to run the following | ||
command using [npm](https://www.npmjs.com/): | ||
@@ -15,4 +14,4 @@ ```bash | ||
If you prefer [Yarn](https://yarnpkg.com/en/), use the following | ||
command instead: | ||
If you prefer [Yarn](https://yarnpkg.com/en/), use the following command | ||
instead: | ||
@@ -25,4 +24,4 @@ ```bash | ||
You can use the `@carbon/colors` module in your JavaScript, in | ||
addition to your Sass. | ||
You can use the `@carbon/colors` module in your JavaScript, in addition to your | ||
Sass. | ||
@@ -37,6 +36,7 @@ ### Sass | ||
This file automatically includes the `carbon--colors` mixin which | ||
initializes all the color variables for the IBM Design Language. | ||
This file automatically includes the `carbon--colors` mixin which initializes | ||
all the color variables for the IBM Design Language. | ||
These color variables follow the naming convention: `$carbon--<swatch>-<grade>`. For example: | ||
These color variables follow the naming convention: `$carbon--<swatch>-<grade>`. | ||
For example: | ||
@@ -50,3 +50,4 @@ ```scss | ||
You can also use the shorthand form of these colors by dropping the `carbon--` namespace: | ||
You can also use the shorthand form of these colors by dropping the `carbon--` | ||
namespace: | ||
@@ -61,9 +62,7 @@ ```scss | ||
_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._ | ||
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: | ||
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: | ||
@@ -77,7 +76,7 @@ ```scss | ||
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: | ||
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: | ||
@@ -97,15 +96,15 @@ <!-- prettier-ignore-start --> | ||
You can include this variable by including `@carbon/colors/scss/colors` | ||
or calling the `carbon--colors()` mixin directly. | ||
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. | ||
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: | ||
Similar to previous efforts, we also provide colors in the formats mentioned | ||
above. For example: | ||
@@ -117,4 +116,4 @@ ```scss | ||
If you would like a mixin to conditionally include these variables, | ||
you can include the mixin by using: | ||
If you would like a mixin to conditionally include these variables, you can | ||
include the mixin by using: | ||
@@ -129,4 +128,4 @@ ```scss | ||
For JavaScript, you can import and use this module by doing the | ||
following in your code: | ||
For JavaScript, you can import and use this module by doing the following in | ||
your code: | ||
@@ -141,5 +140,4 @@ ```js | ||
Each color swatch is exported as a variable, and each color name is | ||
also exported as an object that can be called by specifying grade, for | ||
example: | ||
Each color swatch is exported as a variable, and each color name is also | ||
exported as an object that can be called by specifying grade, for example: | ||
@@ -160,6 +158,5 @@ ```js | ||
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](/.github/CONTRIBUTING.md) | ||
! 👀 | ||
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](/.github/CONTRIBUTING.md) ! 👀 | ||
@@ -166,0 +163,0 @@ ## 📝 License |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
79377
1.63%10
11.11%9
12.5%155
-1.9%21
-8.7%