web: use shared compute_color
This commit is contained in:
parent
d148f625ac
commit
5108213af5
@ -9,6 +9,7 @@ use itertools::Itertools;
|
|||||||
use log::{debug, error, info};
|
use log::{debug, error, info};
|
||||||
use seed::{prelude::*, *};
|
use seed::{prelude::*, *};
|
||||||
use seed_hooks::{state_access::CloneState, topo, use_state};
|
use seed_hooks::{state_access::CloneState, topo, use_state};
|
||||||
|
use shared::compute_color;
|
||||||
use web_sys::HtmlElement;
|
use web_sys::HtmlElement;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@ -29,12 +30,6 @@ fn set_title(title: &str) {
|
|||||||
seed::document().set_title(&format!("lb: {}", title));
|
seed::document().set_title(&format!("lb: {}", title));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compute_color(data: &str) -> String {
|
|
||||||
let mut hasher = DefaultHasher::new();
|
|
||||||
data.hash(&mut hasher);
|
|
||||||
format!("#{:06x}", hasher.finish() % (1 << 24))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn tags_chiclet(tags: &[String], is_mobile: bool) -> impl Iterator<Item = Node<Msg>> + '_ {
|
fn tags_chiclet(tags: &[String], is_mobile: bool) -> impl Iterator<Item = Node<Msg>> + '_ {
|
||||||
tags.iter().map(move |tag| {
|
tags.iter().map(move |tag| {
|
||||||
let hex = compute_color(tag);
|
let hex = compute_color(tag);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user