Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@opengov/capital-style
Advanced tools
Design Tokens and Styles for the OpenGov Capital Design System.
This package contains several resources that can be used for building applications with the visual style of Capital Design System.
You can add this package to your application by running:
yarn add @opengov/capital-style
Tokens are individual variables that can be used to build styles, such as colors, fonts, or size units. We build in JSON under the /tokens
folder. From there they are exported to scss
. A few mixins are added to these tokens as well to build more complex styles (such as focus).
To import just the tokens into your scss
file, place this line at the top of every file you want to use your tokens:
@import “~@opengov/capital-style/scss/tokens;
If your SCSS is compiled all together, this should only be needed once. If you are using CSS Modules in React, this will be needed for every scss
file you need to use the tokens in.
Tokens should be used just like any other variable within your scss, for example:
color: $color-primary-selection;
To reference a token within a function:
width: calc(100vw - #{$unit-20});
To use media queries:
@media #{$mq-small} { ... }
To use mixins:
@include focus-wrap;
Tokens are not currently available in JS.
We offer a few base stylesheets that you can use for your application. We recommend using these only once in your application.
@import “~@opengov/capital-style/scss/tokens;
@import “~@opengov/capital-style/scss/font;
@import “~@opengov/capital-style/scss/base;
@import “~@opengov/capital-style/scss/components;
@import “~@opengov/capital-style/scss/capital;
The capital stylesheet is also compiled as CSS and can be pointed to with:
<link rel="stylesheet" type="text/css" href="[relative file path]/@opengov/capital-style/css/capital.css">
Component styles are written with the namespace .cds-
to avoid conflicts with any existing styles. All children styles will only be affective with the correct parent style.
Styles are written with BEM. Children objects are prefixed with __
and modifiers are prefixed with --
. Modifiers should state what is being modified and then the modification. For example:
.cds-button {
&.cds-button--variantPrimary {}
&.cds-button--sizeDefault {}
svg.cds-button__icon {}
}
Font files are available under /fonts
and can be imported with:
@import “~@opengov/capital-style/scss/font;
You can see all of the token on this Github Page:
https://opengov.github.io/Capital-Style/
import { vizColors } from '@opengov/capital-style/js';
import { getVizColors } from '@opengov/capital-style/js';
Tokens should be added within the /tokens
folder to the appropriate json
file. Update the docs/index.html
to list any new tokens added.
Mixins should be added to the /scss/tokens/mixins
file. Update the docs/index.html
to list any new mixins added.
Component Styles are maintained under /scss/components
.
Please see the above notes on how classes are named and follow this pattern.
NEVER target an HTML element directly without a class used as an identifier.
Styles should always be nested under one parent style for the component.
FAQs
Design Tokens and Styles for the OpenGov Capital Design System.
The npm package @opengov/capital-style receives a total of 1,963 weekly downloads. As such, @opengov/capital-style popularity was classified as popular.
We found that @opengov/capital-style demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 186 open source maintainers collaborating on the project.
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.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.