Search packages, repositories and app categories

Package detailsv1.0.4

pigment

Useful and simple flutter color handler.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
18.1K
Likes
20
Pub points
110

Install package

flutter pub add pigment

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Pigment is a lightweight and intuitive Flutter package designed to simplify color handling in applications. It provides a clean API for creating, manipulating, and converting colors with support for various color models and formats. Ideal for developers seeking a straightforward way to manage color logic without the complexity of larger libraries. Pigment integrates seamlessly across all major platforms, including mobile, web, and desktop, making it versatile for cross-platform projects.

Use cases

  • Color manipulation in UI design
  • Converting between color formats
  • Dynamic theme generation
  • Custom color palettes
  • Simplifying color logic in apps
  • Responsive color adjustments

Key features

  • Easy color creation and parsing
  • Support for multiple color models (HSL, HSV, etc.)
  • Built-in color blending and opacity handling
  • Cross-platform compatibility
  • Minimal boilerplate
  • Extensible color operations

Suitable for

  • Flutter developers needing simple color utilities
  • Apps with dynamic or theme-based color schemes
  • Designers and developers collaborating on UI color systems
  • Projects requiring consistent color management
  • Prototyping and rapid UI development

Considerations

  • Not intended for advanced color theory applications
  • Limited to basic color operations
  • No built-in color picker UI
  • Best suited for straightforward color handling needs
  • Does not replace full-featured color pickers

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Pigment

pub package

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.

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().

Pigment.fromString()
new Pigment()

Example

Here is a small example of the classic and simple pigment use.

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<MyHomePage> {
  @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: <Widget>[
              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)"))),
            ],
          ),
        ));
  }
}

Categories

Source repository

Projects using this package