색상 (Colors)
Pico에는 브랜드 디자인 시스템을 개성 있게 꾸밀 수 있도록 손수 제작된 380가지의 색상이 준비되어 있어요. Red(빨강)부터 Slate(슬레이트)까지, 원하는 색을 폭넓게 활용할 수 있어요.
색상은 CSS 클래스로 바로 적용할 수도 있고, Sass 변수로 불러와 사용할 수도 있어요.
출처: 문서
본문
CSS로 사용하기 (Usage with CSS)
메인 Pico 스타일시트에는 색상 유틸리티가 포함되어 있지 않아요.
색상 유틸리티가 모두 담긴 별도의 스타일시트가 있으니, 웹사이트의 <head>에서 연결하면 돼요.
<link rel="stylesheet" href="css/pico.colors.min.css">
jsDelivr CDN에서도 사용할 수 있어요.
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.colors.min.css"
>
이 스타일시트의 크기는 Pico 라이브러리 전체와 거의 비슷해요.
운영 사이트에 모든 색상을 포함하는 것은 권장하지 않아요. 실제로 사용하는 색상 계열과 음영(shade)만 포함하는 게 좋아요.
색상 유틸리티를 연결한 뒤에는 유틸리티 클래스로 어떤 요소든 스타일링할 수 있어요. 위에 있는 색상을 클릭하면 세부 정보를 볼 수 있어요.
핑크 제목 (Pink title)
<h2 class="pico-color-pink-500">Pink title</h2>
핑크 카드
<article class="pico-background-pink-600">
Pink card
</article>
SASS로 사용하기 (Usage with SASS)
.scss 파일에서 다음과 같이 모든 색상을 Sass 변수로 불러올 수 있어요.
@use "colors" as *;
그러면 색상을 이렇게 사용할 수 있어요.
h2 {
color: $pink-500;
}
@use로 유틸리티 클래스를 생성할 수도 있어요.
@use "colors/utilities";
설정할 수 있는 옵션이 아주 많아요.
예를 들어, 배경 유틸리티는 빼고 색상 유틸리티만, 게다가 red(빨강), pink(핑크), fuchsia(푸시아), purple(보라) 색상 계열에 대해서만 생성하려면 이렇게 하면 돼요.
@use "colors/utilities" with (
$palette: (
"color-families": (
red,
pink,
fuchsia,
purple,
),
),
$utilities: (
"background-colors": false,
)
);
모든 기본 설정
// Prefix for CSS variables
$css-var-prefix: "--pico-" !default; // Must start with "--"
$css-class-prefix: "pico-" !default;
// Palette
$palette: () !default;
$palette: map.merge(
(
// Color families
"color-families": (
red,
pink,
fuchsia,
purple,
violet,
indigo,
blue,
azure,
cyan,
jade,
green,
lime,
yellow,
amber,
pumpkin,
orange,
sand,
grey,
zinc,
slate
),
// Shades
"shades": (
50,
100,
150,
200,
250,
300,
350,
400,
450,
500,
550,
600,
650,
700,
750,
800,
850,
900,
950
),
// Export main color for each family
"enable-main-color": true,
// Export shades for each family
"enable-shades": true,
// Export black and white
"enable-black-and-white": false,
// Light color used for dark backgrounds
"light-color": #fff,
// Dark color used for light backgrounds
"dark-color": #000,
// Export as HEX, RGB or HSL values
"export-as": "hex" // hex | rgb | hsl
),
$palette
);
// Properties names used for CSS variables and classes
// Useful if you want to shorten the names
$properties: () !default;
$properties: map.merge(
(
"color": "color",
"background-color": "background",
),
$properties
);
// Utilities to export
$utilities: () !default;
$utilities: map.merge(
(
// CSS Vars
"css-vars": true,
// Colors utility classes
"colors": true,
// Background color utility classes
"background-colors": true,
// Color value for background color utility classes
"color-for-background-colors": true
),
$utilities
);
Figma에서 가져오기 (Import in Figma)
Figma 플러그인 Palette Importer를 사용하면 380가지 Pico 색상을 모두 가져올 수 있어요.
모든 색상이 담긴 .json 파일을 다운로드하세요.