#rgb #reference #constants

named-colour

named-colour provides Hex Codes for popular colour names

35 releases

0.3.26 Mar 4, 2026
0.3.25 Nov 21, 2025
0.3.24 Oct 21, 2025
0.3.22 Jul 21, 2025
0.1.0 Sep 29, 2021

#188 in Web programming

Download history 530/week @ 2026-01-05 52/week @ 2026-01-12 96/week @ 2026-01-19 526/week @ 2026-01-26 149/week @ 2026-02-02 484/week @ 2026-02-09 158/week @ 2026-02-16 958/week @ 2026-02-23 549/week @ 2026-03-02 276/week @ 2026-03-09 127/week @ 2026-03-16 107/week @ 2026-03-23 323/week @ 2026-03-30 135/week @ 2026-04-06 161/week @ 2026-04-13 29/week @ 2026-04-20

648 downloads per month
Used in pcu

MIT/Apache

145KB
3K SLoC

Rust library named-colour

Crates.io MIT licensed CircleCI Rust Docs OpenSSF Best Practices BuyMeaCoffee GitHubSponsors

The rust library named-colour provides a convenient set of named colours and the Hex Code for each colour.

Installation

To use named-colour in your project you can add the following to your Cargo.toml:

[dependencies]
named-colour = "0.3.26"

Usage

Provides Hex Codes for colours:

  • enums that return a hex code string for named colours
  • rgb colour struct to configure a colour an rgb colour and display as decimal or hex

Examples

Use Basic colour

use named_colour::Basic;
println!("The colour Hex Code is: {} for the RGB colour Aqua: {}",
    Basic::Aqua,
    Basic::Aqua.as_rgb()
);

Use Extended colour

Enable the feature in the toml file:

[dependencies]
named-colour = { version = "0.3.26", features = ["extended"]}
use named_colour::ext::Indigo;
println!("The colour Hex Code is: {} for the RGB colour Dark Orchid: {}",
    Indigo::DarkOrchid,
    Indigo::DarkOrchid.as_rgb()
);

Create a custom colour

use named_colour::ColourRgb;
let my_colour =ColourRgb::new(12,24,48);
println!("The Hex Code is: {} for my_colour: {}",
    my_colour.as_hex(),
    my_colour.to_string()
);

Features

  • Basic contains just 16 colours with 18 names (default)
  • Extended contains a fuller set of colours divided in 11 collections

To use the extended colour set only configure toml with no-default features

[dependencies]
named-colour = { version = "0.3.26", default_features = false, features = ["extended"]}

License

Licensed under either of

Contributing

We welcome contributions! Please see our Contributing Guide for details on:

  • How to submit bug reports and feature requests
  • Our development process and coding standards
  • How to submit pull requests
  • Developer Certificate of Origin (DCO) sign-off requirements

Code of Conduct

This project adheres to a Code of Conduct. By participating, you are expected to uphold this code.

Security

For security vulnerability reports, please see our Security Policy.

Governance

For information about project governance and decision-making, see GOVERNANCE.md.

Changelog

See CHANGELOG.md for a history of changes to this crate.

Dependencies

~0.5–1MB
~23K SLoC