1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//! A perception-aware accent color extractor and dynamic theme generator.
//!
//! ## Table of Contents
//!
//! - [How to get it](#how-to-get-it)
//! - [With cargo](#with-cargo)
//! - [Example](#example)
//! - [Full pipeline](#full-pipeline)
//! - [Template syntax](#template-syntax)
//! - [Configuration](#configuration)
//! - [Links](#links)
//!
//! ## How to get it
//!
//! This crate is available on [crates.io](https://crates.io/crates/gecol-core).
//!
//! ### With cargo
//!
//! ```bash
//! cargo add gecol-core
//! ```
//!
//! ## Example
//!
//! ### Full pipeline
//!
//! You can extract a color, generate a theme and build a template using only
//! a few lines of code:
//!
//! ```rust,no_run
//! use gecol_core::prelude::*;
//! # use std::collections::HashMap;
//! # fn get_templates() -> HashMap<String, Template> { HashMap::new() }
//!
//! # fn main() -> Result<(), gecol_core::Error> {
//! let config = ExtractionConfig::default();
//!
//! // 1. Extract the color from the given image
//! if let Some(color) = Extractor::extract_cached("/path/img.jpg", &config, None)? {
//! // 2. Generate theme based on that color
//! let theme = Theme::dark(color);
//!
//! // 3. Build the configuration file
//! let template = Template::new("config.toml.template", "config.toml");
//! template.build(&theme)?;
//!
//! // Or when having multiple templates (more efficient)
//! let templates: HashMap<String, Template> = get_templates();
//! build_templates(&templates, theme)?;
//! }
//! # Ok(())
//! # }
//! ```
//!
//! ### Template syntax
//!
//! In the templates, you have access to a rich object-oriented color API:
//!
//! ```text
//! background = "{{ background }}"
//! transparent_bg = "{{ background.hexa(0.8) }}"
//! hover_color = "{{ background.lighten(0.1) }}"
//! border = rgba({{ primary.rgb }}aa)
//! ```
//!
//! ## Configuration
//!
//! The [`ExtractionConfig`](crate::extract::ExtractionConfig) struct allows
//! fine-tuning of the extraction algorithm, such as saliency bonus, warmth
//! bias and so on. You can read more about all the fine-tuning options in the
//! [`ExtractionConfig`](crate::extract::ExtractionConfig) documentation.
//!
//! ## Links
//!
//! - **Author:** [Martan03](https://github.com/Martan03)
//! - **GitHub repository:** [gecol](https://github.com/Martan03/gecol)
//! - **Package**: [crates.io](https://crates.io/crates/gecol)
//! - **Documentation**: [docs.rs](https://docs.rs/gecol/latest/gecol/)
//! - **Author website:** [martan03.github.io](https://martan03.github.io)
pub use Cache;
pub use Error;