@@ -51,10 +51,18 @@ Settings.prototype.reloadThemes = function reloadThemes(e) {
5151 e . target . blur ( )
5252}
5353
54+ Settings . prototype . onUserColorChanged = function onUserColorChanged ( e ) {
55+ const val = e . target . value
56+ debug ( 'user.color changed to %s' , val )
57+ this . target . settings . set ( 'user.color' , val )
58+ this . target . needsLayout ( )
59+ }
60+
5461const notes = {
55- ' playSounds' : 'Sounds will be played for things like receiving' +
62+ playSounds : 'Sounds will be played for things like receiving' +
5663 ' a new message.'
57- , 'autoAcceptInvites' : 'Auto join channel when invited.'
64+ , autoAcceptInvites : 'Auto join channel when invited.'
65+ , userColor : 'Set the color of your nickname in all chats'
5866}
5967
6068Settings . prototype . render = function render ( ) {
@@ -111,6 +119,9 @@ Settings.prototype.render = function render() {
111119 , checkbox ( 'autoAcceptInvites' , ( e ) => {
112120 this . onAutoAcceptInvite ( e )
113121 } , ' Auto Accept Invites' , settings , notes . autoAcceptInvites )
122+ , colorPicker ( 'user.color' , ( e ) => {
123+ this . onUserColorChanged ( e )
124+ } , 'Nickname Color' , settings , notes . userColor )
114125 ] )
115126 ] )
116127 ] )
@@ -132,3 +143,25 @@ function checkbox(id, onchange, title, settings, note) {
132143 ] )
133144 ] )
134145}
146+
147+ function colorPicker ( id , onkeyup , title , settings , note ) {
148+ return h ( '.form-group' , [
149+ h ( 'label.control-label' , {
150+ for : id
151+ } , title )
152+ , h ( '.input-group' , [
153+ h ( 'span.input-group-addon' , {
154+ style : {
155+ backgroundColor : settings . get ( id )
156+ }
157+ } )
158+ , h ( 'input.form-control' , {
159+ type : 'text'
160+ , id : id
161+ , onkeyup : onkeyup
162+ , value : settings . get ( id )
163+ } )
164+ ] )
165+ , h ( 'p.form-control-static' , note )
166+ ] )
167+ }
0 commit comments