@@ -2148,7 +2148,7 @@ def _set_default_color(self):
2148
2148
self ._set_color (self ._default_color )
2149
2149
2150
2150
def _set_random_color (self ):
2151
- clr = "#" + Math . floor ( Math . random () * 16777215 ). toString ( 16 )
2151
+ clr = utils . color_random ( )
2152
2152
self ._set_color (clr )
2153
2153
2154
2154
def _set_color (self , clr ):
@@ -3920,9 +3920,18 @@ def open(self, callback=None):
3920
3920
</select>
3921
3921
</div>
3922
3922
<h2><i class='fas'>\uf085 </i> Misc</h2>
3923
+ <div class='formlayout'>
3924
+ <div>Default tag color:</div>
3925
+ <select>
3926
+ <option value='default'>Default</option>
3927
+ <option value='name'>From Tag Name</option>
3928
+ <option value='random'>Random</option>
3929
+ </select>
3930
+ </div>
3923
3931
<label>
3924
3932
<input type='checkbox' checked='true'></input>
3925
- Show elapsed time below start-button</label>
3933
+ Show elapsed time below start-button
3934
+ </label>
3926
3935
3927
3936
<hr style='margin-top: 1em;' />
3928
3937
@@ -3971,6 +3980,7 @@ def open(self, callback=None):
3971
3980
_ , # Time repr header
3972
3981
self ._repr_form ,
3973
3982
_ , # Misc header
3983
+ self ._tag_form ,
3974
3984
self ._stopwatch_label ,
3975
3985
_ , # hr
3976
3986
_ , # Section: per device
@@ -4032,6 +4042,12 @@ def open(self, callback=None):
4032
4042
self ._today_end_offset .value = today_end_offset
4033
4043
self ._today_end_offset .onchange = self ._on_today_end_offset_change
4034
4044
4045
+ # Tag color
4046
+ tag_color = window .simplesettings .get ("tag_color" )
4047
+ self ._tag_color = self ._tag_form .children [1 ]
4048
+ self ._tag_color .value = tag_color
4049
+ self ._tag_color .onchange = self ._on_tag_color_change
4050
+
4035
4051
# Stopwatch
4036
4052
show_stopwatch = window .simplesettings .get ("show_stopwatch" )
4037
4053
self ._stopwatch_check = self ._stopwatch_label .children [0 ]
@@ -4128,6 +4144,10 @@ def _on_stopwatch_check(self):
4128
4144
show_stopwatch = bool (self ._stopwatch_check .checked )
4129
4145
window .simplesettings .set ("show_stopwatch" , show_stopwatch )
4130
4146
4147
+ def _on_tag_color_change (self ):
4148
+ tag_color = self ._tag_color .value
4149
+ window .simplesettings .set ("tag_color" , tag_color )
4150
+
4131
4151
4132
4152
class GuideDialog (BaseDialog ):
4133
4153
"""Dialog to have quick access to the guide."""
0 commit comments