File tree Expand file tree Collapse file tree 4 files changed +70
-1
lines changed
Expand file tree Collapse file tree 4 files changed +70
-1
lines changed Original file line number Diff line number Diff line change @@ -397,6 +397,33 @@ export default class Single extends Component {
397397 Square
398398 </ p >
399399 </ div >
400+ { /* Theme */ }
401+ < div className = "field" >
402+ Theme
403+ </ div >
404+ < div className = "opts" >
405+ < p
406+ className = {
407+ classnames ( "opt" , { active : config . theme === "light" } ) }
408+ onClick = { this . updateConfig . bind ( this , "theme" , "light" ) }
409+ >
410+ Light
411+ </ p >
412+ < p
413+ className = {
414+ classnames ( "opt" , { active : config . theme === "dark" } ) }
415+ onClick = { this . updateConfig . bind ( this , "theme" , "dark" ) }
416+ >
417+ Dark
418+ </ p >
419+ < p
420+ className = {
421+ classnames ( "opt" , { active : config . theme === "system" } ) }
422+ onClick = { this . updateConfig . bind ( this , "theme" , "system" ) }
423+ >
424+ Follow System
425+ </ p >
426+ </ div >
400427 </ div >
401428 </ div >
402429 ) ;
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,42 @@ $headerHeight: 6rem;
365365 margin-top : 1rem ;
366366 }
367367}
368+
369+ // define Dark Mode css
370+ @mixin dark {
371+ .appDark {
372+ .header ,
373+ .appContent {
374+ background : #000 ;
375+ color : #ffffffc2 ;
376+
377+ }
378+ .singleSection {
379+ .info {
380+ .opts {
381+ .opt {
382+ border : 1px solid #b9bcc06b ;
383+ color : #ffffffc2 ;
384+ }
385+ .active {
386+ color : $blue-purple ;
387+ border-color : $blue-purple ;
388+ }
389+ }
390+ }
391+ }
392+ .application {
393+ background-color : #fff ;
394+ }
395+ }
396+ }
397+
398+ // use Dark Mode css
399+ @include dark ;
400+
401+ // follow system
402+ @media (prefers-color-scheme : dark ) {
403+ .appSystemDark {
404+ @include dark ;
405+ }
406+ }
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