Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update for renamed color functions #12

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ From HEX color:

```rust
use std::str::FromStr;
use material_colors::theme_from_source_color;
use material_colors::utils::theme::Theme;
use material_colors::Argb;

fn main() {
let theme = theme_from_source_color(Argb::from_str("#AAE5A4"), Default::default());
let theme = Theme::from_source_color(Argb::from_str("#AAE5A4").unwrap(), Default::default());

// Do whatever you want...
}
Expand All @@ -27,7 +27,7 @@ From image:
> ⚠️ Before obtaining an array of ARGB pixels for the image, **it is recommended** (but not necessary if your image is already small in size or you just don't mind about execution time) to adjust its dimensions to 128x128 (by `resize` function from `image` crate, for example). The reason is described [**here**](https://github.com/material-foundation/material-color-utilities/blob/main/extract_colors.md).

```rust
use material_colors::theme_from_source_color;
use material_colors::utils::theme::Theme;
use material_colors::FilterType;
use material_colors::ImageReader;

Expand All @@ -45,7 +45,7 @@ async fn _main() -> Result<(), reqwest::Error> {
// However, if you don't like the results, you can always try other FilterType values.
data.resize(128, 128, FilterType::Lanczos3);

let theme = theme_from_source_color(ImageReader::extract_color(&data), Default::default());
let theme = Theme::from_source_color(ImageReader::extract_color(&data), Default::default());

// Do whatever you want...

Expand Down
4 changes: 2 additions & 2 deletions tests/image.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[cfg(feature = "image")]
#[tokio::test]
async fn main() -> Result<(), reqwest::Error> {
use material_colors::theme_from_source_color;
use material_colors::utils::theme::Theme;
use material_colors::FilterType;
use material_colors::ImageReader;

Expand All @@ -19,7 +19,7 @@ async fn main() -> Result<(), reqwest::Error> {

println!("{}", color);

_ = theme_from_source_color(color, Default::default());
_ = Theme::from_source_color(color, Default::default());

// Do whatever you want...

Expand Down
Loading