패키지, 저장소 및 앱 카테고리 검색

패키지 상세v3.0.0

color

다양한 색공간에서 색을 생성, 변환, 수정 및 비교하는 데 사용할 수 있는 Color 클래스를 노출하는 간단한 Dart 패키지입니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
82.9만
좋아요
36
Pub 점수
130

패키지 설치

flutter pub add color

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

color 패키지는 여러 색 공간에서 색상 생성, 조작 및 비교를 위한 포괄적인 Color 클래스를 제공하는 가벼운 Dart 라이브러리입니다. 색 변환, 혼합, 비교와 같은 작업을 지원하여 정밀한 색상 처리가 필요한 애플리케이션에 적합합니다. 간단함과 성능을 고려해 설계되었으며, 모든 주요 플랫폼의 Flutter 프로젝트에 원활하게 통합됩니다. 디자인 툴, 테마 시스템, 시각적 애플리케이션 등 정확한 색상 관리가 필수적인 분야에서 특히 유용합니다.

사용 사례

  • 테마 사용자 정의
  • 색 팔레트 생성
  • 시각 디자인 도구
  • 이미지 처리
  • UI 프로토타이핑
  • 다중 플랫폼 색 일관성

주요 기능

  • 다수의 색 공간을 지원합니다
  • 색상 변환 유틸리티
  • 색상 비교 방법
  • 사용하기 쉬운 API
  • Platform-agnostic
  • 확장 가능한 색상 작업

적합한 대상

  • Flutter 개발자
  • 디자인 시스템 제작자
  • UI/UX 디자이너
  • 색 민감성 애플리케이션
  • 크로스 플랫폼 앱
  • 프로토타이핑 도구

고려 사항

  • 기본 색상 작업에 제한됨
  • 내장된 색상 선택기 UI 없음
  • 수동 색상 공간 관리가 필요합니다
  • 복잡한 이미지 분석에 최적화되지 않음
  • 코드 주석 외에 최소한의 문서
  • 런타임 색상 검증 없음

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Color

A simple Dart package exposing a Color class which can be used to create, convert, and compare colors.

Installation

  1. Add this to your package's pubspec.yaml file:
dependencies:
  color: any
  1. Get the package using your IDE's GUI or via command line with
$ pub get
  1. Import the color.dart file in your app
import 'package:color/color.dart';

Usage

Color objects can be constructed using any of a few available constructors.

To create a color from rgb values, call

Color rgbColor = new Color.rgb(192, 255, 238);
RgbColor rgbColor = new RgbColor(192, 255, 238);

Alternatively, a color can be created directly in a number of other color spaces.

RgbColor rgb = new RgbColor(192, 255, 238);
HexColor hex = new HexColor('c0ffee');
HslColor hsl = new HslColor(163.8, 100, 87.6);
XyzColor xyz = new XyzColor(72.931, 88.9, 94.204);
CielabColor cielab = new CielabColor(95.538, -23.02, 1.732);

Colors are immutable, and can be created using const constructors.

RgbColor rgb = const RgbColor(192, 255, 238);

Colors can be created directly from CSS3 color names.

RgbColor black = new RgbColor.name('black'); //factory constructor that returns a const RgbColor
RgbColor white = RgbColor.namedColors['black']; //directly reference the const RgbColor without the factory

Colors implementing the CssColorSpace interface can output a css string representation.

RgbColor rgb = new RgbColor(192, 255, 238);
HexColor hex = new HexColor('c0ffee');
HslColor hsl = new HslColor(163.8, 100, 87.6);
assert(rgb is CssColorSpace, true);
assert(hex is CssColorSpace, true);
assert(hsl is CssColorSpace, true);
print(rgb.toCssString()); //rgb(192, 255, 238)
print(hex.toCssString()); //#c0ffee
print(hsl.toCssString()); //hsl(163.8, 100.0%, 87.6%)

Colors can be compared using the == operator, which will evaluate to true if the two colors share identical rgb values after being rounded to integers.

assert(new Color.hex('c0ffee') == new Color.hex('c0ffee'));
assert(new Color.rgb('192, 255, 238') == new Color.hex('c0ffee'));

Colors can be converted from one color space to another by calling the appropriate toXXXColor method on them.

HslColor hsl = new RgbColor(192, 255, 238).toHslColor();

Colors can be altered using a ColorFilter, which will return a new color in the same color space as the input color with that filter applied to it.

RgbColor grey = ColorFilter.greyscale(new RgbColor(192, 255, 238));
HslColor sepia = ColorFilter.sepia(new HslColor(163.8, 100, 87.6));

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트