Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@skbkontur/colors
Advanced tools
NPM-пакет для доступа к цветам из общей Figma-библиотеки [Kontur.Colors](https://www.figma.com/file/XuiIin3JAOEcHHPihtthOJ/%E2%9A%A1%EF%B8%8F-Kontur-Colors?node-id=0%3A1&t=pL38Ju5ZOo3VC6vt-0)
NPM-пакет для доступа к цветам из общей Figma-библиотеки Kontur.Colors
npm i @skbkontur/colors
KonturColors.colorName
--kontur-color-name
в :root { ... }
@color-name
и SCSS $color-name
import { KonturColors } from '@skbkontur/colors';
const text = `<div style="color: ${KonturColors.blueDark90}">Цвет blueDark90</div>`;
import { KonturColors } from '@skbkontur/colors';
const Component = () => {
return <div style={{ color: KonturColors.blueDark90 }}>Цвет blueDark90</div>;
};
@import '@skbkontur/colors/colors.css';
.class {
color: var(--blue-dark-90);
}
@import '@skbkontur/colors/colors.scss';
.class {
color: $blue-dark-90;
}
@import '@skbkontur/colors/colors.less';
.class {
color: @blue-dark-90;
}
import { KonturColors } from '@skbkontur/colors';
import {
Toast,
DropdownMenu,
MenuHeader,
MenuItem,
ThemeContext,
ThemeFactory,
THEME_2022_UPDATE_2024,
} from '@skbkontur/react-ui';
import { css } from '@skbkontur/react-ui/lib/theming/Emotion';
const styles = {
colors: css`
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 24px;
`,
colorGroup: css`
break-inside: avoid;
margin-bottom: 64px;
`,
colorBlock: css`
display: flex;
align-items: center;
gap: 10px;
width: 100%;
border: none;
text-align: left;
background: none;
cursor: pointer;
padding: 8px;
border-radius: 8px;
transition: 0.1s ease;
&:hover {
background: rgba(0, 0, 0, 0.06);
}
&:active {
background: rgba(0, 0, 0, 0.1);
}
`,
colorTile: css`
display: block;
height: 32px;
width: 32px;
border: 1px solid rgba(0, 0, 0, 0.08);
border-radius: 8px;
flex-shrink: 0;
`,
groupTitle: css`
display: block;
font-size: 20px;
font-weight: 600;
margin: 0 8px 12px;
`,
title: css`
display: block;
padding: 1px 0 0 8px;
`,
colorName: css`
display: block;
font-size: 14px;
line-height: 1.2;
`,
colorValue: css`
display: block;
fontSize: 12px;
color: #8b8b8b;
}`,
};
const colorGroups = Object.entries(KonturColors).reduce((acc, [colorKey, colorValue]) => {
const firstWord = ['greenMint', 'blueDark'].find((color) => colorKey.match(color)) || colorKey.match(/^[a-z]+/)[0];
acc[firstWord] = { ...acc[firstWord], [colorKey]: colorValue };
return acc;
}, {});
const getColors = (color) => {
const colorDashCase = color
.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase())
.replace(/\d/, (m) => `-${m}`)
.replace('f-f-f', 'fff');
return {
'JavaScript / TypeScript': `KonturColors.${color}`,
CSS: `var(--kontur-${colorDashCase})`,
SCSS: `$${colorDashCase}`,
Less: `@${colorDashCase}`,
};
};
const copyColor = (color) => {
navigator.clipboard.writeText(color);
Toast.push('Цвет скопирован', null, 1000);
};
<div className={styles.colors}>
<ThemeContext.Provider value={THEME_2022_UPDATE_2024}>
{Object.entries(colorGroups).map(([group, colors]) => {
return (
<div className={styles.colorGroup}>
<div className={styles.groupTitle}>{group}</div>
{Object.keys(colors).map((colorName) => {
const colorValue = KonturColors[colorName];
const colorTile = (
<div className={styles.colorBlock}>
<span className={styles.colorTile} style={{ backgroundColor: colorValue }} />
<span>
<span className={styles.colorName}>{colorName}</span>
<span className={styles.colorValue}>{colorValue}</span>
</span>
</div>
);
return (
<div>
<DropdownMenu caption={colorTile} width="300">
<MenuHeader>Скопировать переменную</MenuHeader>
{Object.entries(getColors(colorName)).map(([lang, color]) => (
<MenuItem onClick={() => copyColor(color)} comment={lang}>
<div style={{ minWidth: 270 }}>{color}</div>
</MenuItem>
))}
</DropdownMenu>
</div>
);
})}
</div>
);
})}
</ThemeContext.Provider>
</div>;
camelCase
src/colors.ts
— файл с токенамиnpm run build
— сборка пакета в /dist
FAQs
NPM-пакет для доступа к цветам из общей Figma-библиотеки [Kontur.Colors](https://www.figma.com/file/XuiIin3JAOEcHHPihtthOJ/%E2%9A%A1%EF%B8%8F-Kontur-Colors?node-id=0%3A1&t=pL38Ju5ZOo3VC6vt-0)
We found that @skbkontur/colors demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.