Switch color with dark mode on macOS
This commit is contained in:
		| @@ -15,17 +15,21 @@ import Welcome from '@/components/Welcome.vue' | |||||||
|   }, |   }, | ||||||
| }) | }) | ||||||
| export default class App extends Vue { | export default class App extends Vue { | ||||||
|   public color: string = '#2c3e50' |   public color: string = this.isDarkMode ? 'white' : 'black' | ||||||
|   public backgroundColor: string = 'white' |   public backgroundColor: string = this.isDarkMode ? '#212121' : 'white' | ||||||
|   public fontSize: string = '16px' |   public fontSize: string = '16px' | ||||||
|  |  | ||||||
|   public get styles(): { [key: string]: string } { |   public get styles(): { [key: string]: string } { | ||||||
|     return { |     return { | ||||||
|       '--color': this.color, |       '--color': this.color, | ||||||
|       '--background-color': this.backgroundColor, |       '--bg-color': this.backgroundColor, | ||||||
|       '--font-size': this.fontSize, |       '--font-size': this.fontSize, | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   public get isDarkMode(): boolean { | ||||||
|  |     return remote.systemPreferences.isDarkMode() | ||||||
|  |   } | ||||||
| } | } | ||||||
| </script> | </script> | ||||||
|  |  | ||||||
| @@ -42,7 +46,7 @@ body { | |||||||
| } | } | ||||||
| #app { | #app { | ||||||
|   color: var(--color); |   color: var(--color); | ||||||
|   background-color: var(--background-color); |   background-color: var(--bg-color); | ||||||
|   font-size: var(--font-size); |   font-size: var(--font-size); | ||||||
|  |  | ||||||
|   text-align: center; |   text-align: center; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	