HEX to Flutter Dart Color Code Formatter
Convert HEX to Flutter Dart const Color(0xFFRRGGBB) with an alpha channel, plus Color.fromRGBO output. Instant, private and ready to paste.
Color
Generated code
const Color(0xFF3B82F6)const Color.fromRGBO(59, 130, 246, 1.0)Technical Specification & Mathematical Principles
How the Flutter Color Code Generator Works
Flutter's Color class wraps a 32-bit ARGB integer. The first byte is alpha, then red, green and blue, so a fully opaque #3B82F6 is written const Color(0xFF3B82F6). Setting the opacity slider to 50% changes the prefix from FF to 80 because 0.5 x 255 rounds to 128, which is 0x80.
The alternative constructor Color.fromRGBO(r, g, b, opacity) takes decimal channels and a 0 to 1 opacity. It is more readable when the alpha value matters, and the generator prints both forms.
Frequently Asked Questions
Why does Flutter use 0xFF instead of #?
Can I make the color const?
How do I get a transparent variant of an existing color?
Related Design & Color Instruments
Android Color Converter
Convert HEX to Jetpack Compose Color(0xFF...) and Android XML color resources with alpha. Copy ready-to-paste Kotlin and colors.xml snippets instantly.
SwiftUI Color Code Generator
Turn any HEX color into SwiftUI Color(.sRGB, red:, green:, blue:, opacity:) code, plus a UIKit UIColor snippet. Free, instant and processed locally.
Design Tokens Export (DTCG JSON)
Generate W3C Design Tokens Community Group JSON for colors with $value and $type. Name up to 12 tokens and copy a spec-shaped file for Style Dictionary.
HEX to RGBA Converter
Convert hex color codes to rgba(r, g, b, a) format with an interactive transparency slider from 0.00 to 1.00.