catppuccin 0.2.2 copy "catppuccin: ^0.2.2" to clipboard
catppuccin: ^0.2.2 copied to clipboard

Soothing pastel library for Dart.

Logo
Catppuccin for Dart

Get started with example/main.dart

Installation #

To use Catppuccin in a Dart / Flutter project, you can follow these steps:

  1. Add Catppuccin to Your pubspec.yaml File: Open your pubspec.yaml file and add the following line under the dependencies section:
    dependencies:
        # ...
        catppuccin: ^0.2.2
        # ...
    
  2. After adding catppuccin to your pubspec.yaml file, run the following command in your terminal to fetch the packages:
    flutter pub get
    
    If you are not building a flutter app, you can use:
    dart pub get
    

Usage #

import 'package:catppuccin/src/catppuccin_base.dart';

void main() {
  List<int> blue = variants[FlavorNames.mocha]![FlavorColorKeys.blue]!.rgb;
  print(blue); //[137, 180, 250]
}

  • FlavorColorKeys and FlavorNames are enums that are used to represent fixed sets of color keys and flavor names, respectively.
  • ColorInfo encapsulates color information, including RGB, hex, and HSL values.
  • variants is a map that associates flavor names FlavorNames with color information ColorInfo for various color keys FlavorColorKeys.

Tips for flutter projects #

Use the below code snipet to convert the value field of the map to the Color data structure of the flutter library.

import 'package:catppuccin/catppuccin.dart';
import 'package:flutter/material.dart';

Map<FlavorColorKeys, Color> convertColorInfoMapToColorMap(
    Map<FlavorColorKeys, ColorInfo> colorInfoMap) {
  return colorInfoMap.map((key, colorInfo) => MapEntry(key,
      Color.fromRGBO(colorInfo.rgb[0], colorInfo.rgb[1], colorInfo.rgb[2], 1)));
}

Map<FlavorColorKeys, Color> mocha =
    convertColorInfoMapToColorMap(variants[FlavorNames.mocha]!);

Color pink = mocha[FlavorColorKeys.pink]!;

Contributing #

If you are looking to contribute, please read through our CONTRIBUTING.md first!

💝 Thanks to #

Copyright © 2022-present Catppuccin Org

0
likes
150
points
41
downloads

Documentation

API reference

Publisher

verified publisheritzapril.tech

Weekly Downloads

Soothing pastel library for Dart.

License

MIT (license)

More

Packages that depend on catppuccin