material_color_names 1.0.0 copy "material_color_names: ^1.0.0" to clipboard
material_color_names: ^1.0.0 copied to clipboard

A function to convert a string to a color, including material Colors constants.

Material Color Names #

A function to convert a string to a color, including material Colors constants and hexadecimal values. Does not do the reverse operation, and is pretty fast.

Supports inputs like:

  • "green" for simple material colors (Colors.green).
  • "redAccent.100" for color shades (Colors.redAccent.shade100).
  • "0xff15d6e1" for hexadecimal colors with an alpha channel (Color(0xff15d6e1)).
  • "#34A" for short hexadecimal colors (Color(0xFF3344AA)).

Usage #

import 'package:material_color_names/material_color_names.dart';

void main() {
  print(colorFromString('#feac'));
  print(colorFromString('lightBlue.900'));
}
copied to clipboard

The function knows every color from the Colors class.

0
likes
150
points
43
downloads

Publisher

verified publisherilya.zverev.info

Weekly Downloads

2024.09.15 - 2025.03.30

A function to convert a string to a color, including material Colors constants.

Repository (GitHub)
View/report issues

Documentation

API reference

License

ISC (license)

Dependencies

flutter

More

Packages that depend on material_color_names