File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1727,6 +1727,13 @@ pub fn Editor<'a>(
1727
1727
let input: HtmlSelectElement = event. target ( ) . unwrap ( ) . dyn_into ( ) . unwrap ( ) ;
1728
1728
set_gayness ( input. value ( ) . as_str ( ) . into ( ) ) ;
1729
1729
} ;
1730
+ let toggle_rgb_bindings = move |_| {
1731
+ set_timeout (
1732
+ move || get_state. get ( ) . refresh_code ( ) ,
1733
+ Duration :: from_millis ( 0 ) ,
1734
+ ) ;
1735
+ set_rgb_bindings ( !get_rgb_bindings ( ) ) ;
1736
+ } ;
1730
1737
set_font_name ( & get_font_name ( ) ) ;
1731
1738
set_font_size ( & get_font_size ( ) ) ;
1732
1739
@@ -1992,6 +1999,14 @@ pub fn Editor<'a>(
1992
1999
</option>
1993
2000
</select>
1994
2001
</div>
2002
+ <div title="Color constant [r g b] bindings according to their value" >
2003
+ "RGB bindings:"
2004
+ <input
2005
+ type ="checkbox"
2006
+ checked=get_rgb_bindings
2007
+ on: change=toggle_rgb_bindings
2008
+ />
2009
+ </div>
1995
2010
<div title="Show line values to the right of the code" >
1996
2011
"Show values:"
1997
2012
<input
@@ -2437,6 +2452,9 @@ fn binding_class(name: &str, docs: &BindingDocs) -> &'static str {
2437
2452
}
2438
2453
2439
2454
fn binding_style ( docs : & BindingDocs ) -> String {
2455
+ if !get_rgb_bindings ( ) {
2456
+ return String :: new ( ) ;
2457
+ }
2440
2458
if let BindingDocsKind :: Constant ( Some ( val) ) = & docs. kind {
2441
2459
if let Ok ( nums) = val. as_nums ( & IgnoreError , "" ) {
2442
2460
if let [ r, g, b] = * nums {
Original file line number Diff line number Diff line change @@ -1629,6 +1629,13 @@ pub fn set_gayness(gayness: Gayness) {
1629
1629
_ = window ( ) . location ( ) . reload ( ) ;
1630
1630
}
1631
1631
1632
+ pub fn get_rgb_bindings ( ) -> bool {
1633
+ get_local_var ( "rgb-bindings" , || true )
1634
+ }
1635
+ pub fn set_rgb_bindings ( rgb_bindings : bool ) {
1636
+ set_local_var ( "rgb-bindings" , rgb_bindings) ;
1637
+ }
1638
+
1632
1639
fn update_style ( ) {
1633
1640
let font_name = get_font_name ( ) ;
1634
1641
let font_size = get_font_size ( ) ;
You can’t perform that action at this time.
0 commit comments