File tree Expand file tree Collapse file tree 4 files changed +65
-1
lines changed
Expand file tree Collapse file tree 4 files changed +65
-1
lines changed Original file line number Diff line number Diff line change @@ -387,6 +387,33 @@ export default class Single extends Component {
387387 Square
388388 </ p >
389389 </ div >
390+ { /* Theme */ }
391+ < div className = "field" >
392+ Theme
393+ </ div >
394+ < div className = "opts" >
395+ < p
396+ className = {
397+ classnames ( "opt" , { active : config . theme === "light" } ) }
398+ onClick = { this . updateConfig . bind ( this , "theme" , "light" ) }
399+ >
400+ Light
401+ </ p >
402+ < p
403+ className = {
404+ classnames ( "opt" , { active : config . theme === "dark" } ) }
405+ onClick = { this . updateConfig . bind ( this , "theme" , "dark" ) }
406+ >
407+ Dark
408+ </ p >
409+ < p
410+ className = {
411+ classnames ( "opt" , { active : config . theme === "system" } ) }
412+ onClick = { this . updateConfig . bind ( this , "theme" , "system" ) }
413+ >
414+ Follow System
415+ </ p >
416+ </ div >
390417 </ div >
391418 </ div >
392419 ) ;
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ export default class App extends Component {
3131 const { currentTab, config } = this . state ;
3232
3333 return (
34- < div className = "app" >
34+ < div className = { classnames ( "app" , { appDark : config . theme === "dark" , appSystemDark : config . theme === "system" } ) } >
3535 < a className = "iconfont icon-github" href = "https://github.com/chilllab/react-nice-avatar" />
3636
3737 < header className = "header" >
Original file line number Diff line number Diff line change @@ -365,3 +365,37 @@ $headerHeight: 6rem;
365365 margin-top : 1rem ;
366366 }
367367}
368+
369+ // Dark Mode
370+ .appDark {
371+ .header ,
372+ .appContent {
373+ background : #000 ;
374+ color : #ffffffc2 ;
375+
376+ }
377+ .singleSection {
378+ .info {
379+ .opts {
380+ .opt {
381+ border : 1px solid #b9bcc06b ;
382+ color : #ffffffc2 ;
383+ }
384+ .active {
385+ color : $blue-purple ;
386+ border-color : $blue-purple ;
387+ }
388+ }
389+ }
390+ }
391+ .application {
392+ background-color : #fff ;
393+ }
394+ }
395+
396+ // follow system
397+ @media (prefers-color-scheme : dark ) {
398+ .appSystemDark {
399+ @extend .appDark ;
400+ }
401+ }
Original file line number Diff line number Diff line change @@ -200,5 +200,8 @@ export const genConfig = (userConfig = {}) => {
200200 // Background color
201201 response . bgColor = userConfig . bgColor || _pickRandomFromList ( bgColor , { avoidList : [ response . hairColor , response . shirtColor ] } ) ;
202202
203+ // Theme
204+ response . theme = userConfig . theme || "light" ;
205+
203206 return response ;
204207} ;
You can’t perform that action at this time.
0 commit comments