-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created dark theme #330
base: master
Are you sure you want to change the base?
Created dark theme #330
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
<v-app | ||
id="app-wrapper" | ||
> | ||
<link href="https://cdn.jsdelivr.net/npm/@mdi/[email protected]/css/materialdesignicons.min.css" rel="stylesheet"> | ||
<router-view /> | ||
</v-app> | ||
</template> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ import About from './pages/About.vue'; | |
import Vuetify from 'vuetify'; | ||
import VueRouter from 'vue-router'; | ||
import VueCookies from 'vue-cookies'; | ||
import colors from 'vuetify/es5/util/colors'; | ||
import './css/app.css'; | ||
|
||
import { library } from '@fortawesome/fontawesome-svg-core'; | ||
|
@@ -18,7 +19,27 @@ library.add(faSignInAlt, faSignOutAlt, faCloudDownloadAlt, faCloudUploadAlt); | |
|
||
Vue.component('font-awesome-icon', FontAwesomeIcon); | ||
|
||
Vue.use(Vuetify); | ||
Vue.use(Vuetify, { | ||
theme: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it might be better to keep the theme general, so like |
||
primary: '#F26521', | ||
defaultPrimary: '#1976D2', | ||
discordOrange: '#F26521', | ||
discordPurple: '#7289DA', | ||
crlogo: colors.blueGrey.darken2, | ||
crlogoDark: colors.blueGrey.darken2, | ||
crlogoLight: colors.blueGrey.lighten5, | ||
background: colors.grey.darken4, | ||
background2: colors.grey.darken4, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need to duplicate these two? |
||
search: colors.grey.darken4, | ||
backgroundDark: colors.grey.darken4, | ||
backgroundLight: colors.grey.lighten2, | ||
background2Light: colors.grey.lighten4, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are there not already colors like this as part of the Vuetify default theme? I feel like we should just be able to use what's already there, and override that if it's not sufficient. |
||
searchLight: colors.shades.white, | ||
warning: colors.yellow.base, | ||
success: colors.green.base, | ||
error: colors.red.base | ||
} | ||
}); | ||
Vue.use(VueCookies); | ||
Vue.use(VueRouter); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,15 +35,14 @@ | |
</v-flex> | ||
</v-layout> | ||
<v-layout v-else> | ||
<v-flex xs10 :style="{ 'color': semData.textColor }"> | ||
<v-flex xs10 :class="semData.textColor+'--text '+textBrightness"> | ||
{{ semData.message }} | ||
</v-flex> | ||
</v-layout> | ||
</v-layout> | ||
</v-container> | ||
|
||
<v-container | ||
class="lighten-3" | ||
fluid | ||
grid-list-md | ||
:class="semData.bgColor" | ||
|
@@ -93,6 +92,10 @@ export default { | |
}; | ||
}, | ||
computed: { | ||
textBrightness () { | ||
var value = 'text--' + (this.$store.state.useDarkTheme ? 'lighten-2' : 'darken-4'); | ||
return value; | ||
}, | ||
isActiveRoad () { | ||
return this.$store.state.activeRoad === this.roadID; | ||
}, | ||
|
@@ -176,50 +179,50 @@ export default { | |
if (this.addingFromCard || this.draggingOver) { | ||
if (!this.subjectsLoaded) { | ||
return { | ||
bgColor: 'red', | ||
bgColor: 'error', | ||
message: 'Loading subjects... give us a minute', | ||
textColor: 'DarkRed' | ||
textColor: 'error' | ||
}; | ||
} else if (this.itemAdding === undefined) { | ||
return { | ||
bgColor: 'red', | ||
bgColor: 'error', | ||
message: 'If you see this message, contact [email protected] and tell them "710".', | ||
textColor: 'DarkRed' | ||
textColor: 'error' | ||
}; | ||
} else if (this.index === 0 || this.offeredNow) { | ||
return { | ||
bgColor: 'green', | ||
bgColor: 'success', | ||
message: 'Add class here', | ||
textColor: 'DarkGreen' | ||
textColor: 'success' | ||
}; | ||
} else if (this.itemAddingNoLongerOffered) { | ||
return { | ||
bgColor: 'yellow', | ||
bgColor: 'warning', | ||
message: 'Subject no longer offered', | ||
textColor: 'DarkGoldenRod' | ||
textColor: 'warning' | ||
}; | ||
} else if (this.itemAddingNotCurrentlyOffered) { | ||
return { | ||
bgColor: 'yellow', | ||
bgColor: 'warning', | ||
message: 'Subject not offered this year', | ||
textColor: 'DarkGoldenRod' | ||
textColor: 'warning' | ||
}; | ||
} else if (this.isSameYear) { | ||
return { | ||
bgColor: 'red', | ||
bgColor: 'error', | ||
message: 'Subject not available this semester', | ||
textColor: 'DarkRed' | ||
textColor: 'error' | ||
}; | ||
} else { | ||
return { | ||
bgColor: 'yellow', | ||
bgColor: 'warning', | ||
message: 'Subject may not be available this semester', | ||
textColor: 'DarkGoldenRod' | ||
textColor: 'warning' | ||
}; | ||
} | ||
} | ||
return { | ||
bgColor: 'grey', | ||
bgColor: 'background', | ||
message: '', | ||
textColor: '' | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
<template> | ||
<v-app | ||
id="app-wrapper" | ||
:dark="useDark" | ||
> | ||
<v-dialog v-model="showMobile" fullscreen> | ||
<v-card height="100%"> | ||
|
@@ -30,7 +31,7 @@ | |
</v-container> | ||
</v-card> | ||
</v-dialog> | ||
<v-toolbar fixed app dense class="elevation-2"> | ||
<v-toolbar fixed app dense class="elevation-2 background2"> | ||
<road-tabs | ||
slot="extension" | ||
@delete-road="$refs.authcomponent.deleteRoad($event)" | ||
|
@@ -76,14 +77,26 @@ | |
<v-container fill-height style="padding: 0;"> | ||
<v-layout fill-height column> | ||
<v-layout shrink style="padding: 14px; padding-bottom: 0;" row align-center> | ||
<v-flex shrink class="blue-grey lighten-5" style="user-select: none; color: inherit; text-decoration: none; border-radius: 2px; padding: 6px 8px; display: inline-block;"> | ||
<v-flex shrink class="crlogo" style="user-select: none; color: inherit; text-decoration: none; border-radius: 2px; padding: 6px 8px; display: inline-block;"> | ||
<v-icon size="1.3em" color="#00b300"> | ||
check_box | ||
</v-icon> | ||
<h3 style="display: inline;"> | ||
C o u r s e R o a d | ||
</h3> | ||
</v-flex> | ||
<v-flex> | ||
<v-btn | ||
class="mx-2 elevation-2" | ||
dark | ||
fab | ||
small | ||
color="primary" | ||
@click="useDark = !useDark" | ||
> | ||
<v-icon>mdi-{{ useDark ? 'white-balance-sunny' : 'weather-night' }}</v-icon> | ||
</v-btn> | ||
</v-flex> | ||
<v-flex> | ||
<router-link to="/about" style="float: right;"> | ||
About | ||
|
@@ -165,7 +178,7 @@ | |
|
||
<v-footer v-if="!dismissedOld || !dismissedCookies" fixed style="height: unset;"> | ||
<v-layout column> | ||
<v-flex v-if="!dismissedOld" class="lime accent-1 py-1 px-2"> | ||
<v-flex v-if="!dismissedOld" class="discord-purple py-1 px-2"> | ||
<v-layout row align-center> | ||
<v-flex> | ||
Looking for the old courseroad? Visit the old website <a target="_blank" href="https://courseroad.mit.edu/old">here</a> and export your roads! | ||
|
@@ -178,7 +191,7 @@ | |
</v-layout> | ||
</v-flex> | ||
<v-divider v-if="!dismissedOld && !dismissedCookies" /> | ||
<v-flex v-if="!dismissedCookies" class="lime accent-3 py-1 px-2"> | ||
<v-flex v-if="!dismissedCookies" class="discordPurple py-1 px-2"> | ||
<v-layout row align-center> | ||
<v-flex> | ||
This website uses cookies and session storage to store your data and login token, and important features like saving roads will not work without them. | ||
|
@@ -254,6 +267,19 @@ export default { | |
}; | ||
}, | ||
computed: { | ||
useDark: { | ||
get () { | ||
return this.$store.state.useDarkTheme; | ||
}, | ||
set (value) { | ||
this.$store.commit('setUseDarkTheme', value); | ||
this.$vuetify.theme.primary = value ? this.$vuetify.theme.discordOrange : this.$vuetify.theme.defaultPrimary; | ||
this.$vuetify.theme.background = value ? this.$vuetify.theme.backgroundDark : this.$vuetify.theme.backgroundLight; | ||
this.$vuetify.theme.background2 = value ? this.$vuetify.theme.backgroundDark : this.$vuetify.theme.background2Light; | ||
this.$vuetify.theme.search = value ? this.$vuetify.theme.backgroundDark : this.$vuetify.theme.searchLight; | ||
this.$vuetify.theme.crlogo = value ? this.$vuetify.theme.crlogoDark : this.$vuetify.theme.crlogoLight; | ||
} | ||
Comment on lines
+274
to
+281
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm pretty sure this whole block can be handled just by setting different themes for dark and light mode in the initial theme setup |
||
}, | ||
activeRoad: { | ||
get () { | ||
return this.$store.state.activeRoad; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these should already be bundled with the app? Definitely check out how other icons are done. We shouldn't need to import more