Closed mondeja closed 7 months ago
Interesting!
I mean there is an option initial_value
which you can use for this. (you probably already do?)
But yeah this could be useful to a number of people.
I think the fallback shouldn't change and we already have an option to enable/disable storage. So I don't think we need the option initial_value_from_storage
.
I'm not sure what the ...from_url
would do. Would that just activate the discovery? And then use the ...param
option to see which it is?
I think we can simplify this to one option parameter
#[builder(into)]
inital_value_from_url_param: Option<String>
and if that is Some(...)
we try discovering from that url param. If that is not present we use the exisiting discovering mechanisms.
This would be very ergonomic because with this you would only have to call .initial_value_from_url_param("color-scheme")
to activate this.
I mean there is an option
initial_value
which you can use for this. (you probably already do?)
Yes, I'm using it but want to get rid of.
I think we can simplify this to one option parameter ... and if that is Some(...) we try discovering from that url param. If that is not present we use the exisiting discovering mechanisms.
Looks great 👍🏼
Hi. I was wondering if there is some way to standarize how to obtain the initial color mode when using
use_color_mode
. Currently, I'm getting it from:color-scheme
. If exists, is updated on localstorage and used as the initial color mode.color-scheme
.Seems to me that it would not be crazy to implement this logic in
use_color_mode
directly. Perhaps adding the next parameters is enough:initial_value_from_url
(bool): Try to discover the initial value from a URL parameter.initial_value_from_url_param
(str): URL parameter to use trying to discover the initial value.initial_value_from_storage
(bool): Try to discover the initial value from storage.It the color mode is not found trying to discover it following this order would fallback to
initial_value
anduse_preferred_dark
. What do you think about it?Perhaps a more general API to set autodiscovered values in all functions that accept an
initial_value
would be better.