Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bregydoc/pigment
A simple but useful package to play with colors in flutter
https://github.com/bregydoc/pigment
Last synced: about 2 months ago
JSON representation
A simple but useful package to play with colors in flutter
- Host: GitHub
- URL: https://github.com/bregydoc/pigment
- Owner: bregydoc
- License: mit
- Created: 2018-04-09T03:47:37.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-04-25T23:12:25.000Z (about 3 years ago)
- Last Synced: 2024-01-28T04:19:19.516Z (5 months ago)
- Language: Dart
- Homepage:
- Size: 229 KB
- Stars: 215
- Watchers: 6
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Lists
- awesome-flutter - Pigment - Simple but useful package for use colors in flutter. (Components / Styling)
- awesome-flutter - Pigment - Simple but useful package for use colors in flutter. (Components / Styling)
- awesome-flutter-cn - Pigment - 在 Flutter 中使用颜色的简单但实用的包。 (组件 / 样式)
- awesome-flutter - Pigment - Simple but useful package for use colors in flutter. (Components / Styling)
- -awesome-flutter - Pigment - Simple but useful package for use colors in flutter. (Components / Styling)
- awesome-flutter - Pigment - Simple but useful package for use colors in flutter. (Components / Styling)
- awesome-flutter - Pigment - Simple but useful package for use colors in flutter. (Components / Styling)
- awesome-flutter - Pigment - Simple but useful package for use colors in flutter. (Components / Styling)
- awesome-flutter - Pigment - Simple but useful package for use colors in flutter. (Components / Styling)
- awesome-flutter - Pigment - Simple but useful package for use colors in flutter. (Components / Styling)
- awesome-flutter - Pigment - Simple but useful package for use colors in flutter. (Components / Styling)
- awesome-flutter-cn - Pigment - 简单但有效的颜色工具 (组件 / 样式)
- awesome-flutter - Pigment - A simple but useful package to play with colors in flutter ` 📝 2 months ago ` (Styling [🔝](#readme))
README
![]()
# Pigment
[![pub package](https://img.shields.io/pub/v/pigment.svg)](https://pub.dartlang.org/packages/pigment)
A simple but useful plugin for use colors with Flutter
## Features
- You can use string colors (like #01E19F) direct in flutter
- Pigment extends to Color dar:ui class, then you can use all methods of Color class
- Pigment 1.0.1 can parse 'rgb()' (e.g. 'rgb(29, 123, 10)').
- Added CSS colors with default name, you can access from this with CSSColor.\* (e.g. `Pigment.fromCSSColor(CSSColor.lightsalmon)`) or directly with `Pigment.fromString('lightsalmon')`.## Installation
First, add `pigment` as a [dependency in your pubspec.yaml file](https://flutter.io/using-packages/).
## Use
It's very simple, pigment add a new useful method to Color class, this method is `Pigment.fromString()`.
Also like Color, you can use `new Pigment()`.
```dart
Pigment.fromString()
new Pigment()
```## Example
Here is a small example of the classic and simple pigment use.
```dart
import 'package:flutter/material.dart';
import 'package:pigment/pigment.dart';void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Pigment Demo',
theme: new ThemeData(
primarySwatch: Colors.red,
),
home: new MyHomePage(),
);
}
}class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => new _MyHomePageState();
}class _MyHomePageState extends State {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text('Pigment App'),
),
body: new Center(
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
new Text('Pigment is cool',
style: new TextStyle(color: Pigment.fromString("#FE5567"))),
new Text('Pigment is cool',
style: new TextStyle(color: Pigment.fromString("#01E19F"))),
new Text('Pigment is cool',
style: new TextStyle(color: Pigment.fromString("#4A48D2"))),
new Text('Pigment is cool',
style: new TextStyle(color: Pigment.fromString("rgb(253, 196, 86)"))),
],
),
));
}
}
```