In other words, my question is what does <v-toolbar light>'s light actually means?
After I change
Vue.use(Vuetify, {
theme: {
primary: colors.purple,
secondary: colors.grey.darken1,
accent: colors.shades.black,
error: colors.red.accent3
}
})
Nothing happens to <v-toolbar> and I have to apply color attribute to every element, e.g. <v-btn color="primary">primary</v-btn>.
After I specific a color, keyword dark will only affect font color.
e.g. <v-toolbar color="primary" dark> will show primary color and white font.
That is not what I want, how to replace default darkand light with totally custom theme colors. example theme
You can edit the dark and light theme css by going into the vuetify code and editing their style files. They use stylus and any edits should be reflected immediately. To find the style code go to:
yourproject/node_modules/vuetify/src/stylus/settings/_theme.styl
and in there you'll find
$material-light := {
...
}
and
$material-dark := {
...
}
which have the styling for background, fonts, cards, etc.
You should be able to edit it as you see fit.
Otherwise to save editing your node modules folder you can do the following:
create a folder called stylus in your src folder
create a file called main.styl
add this to that file: #import '~vuetify/src/stylus/main'
Then in your main.js add this import './stylus/main.styl
If you then restart your app the styles should now be working from your import.
Edit your src/main.styl file before the import statement and any changes will override the default
eg:
//src/stylus/main.styl
$material-light.background = #36EF45
$body-font-family = 'Raleway'
$alert-font-size = 18px
#import '~vuetify/src/stylus/main'
Anything you don't change will stay with the default.
Related
I have a small vuetify 2.x app that displays a list with the dark theme.
When I scroll beyond the end of the list (top or bottom) I see a white zone appearing for a second.
Is it possible to set the window background color to black, or the same as the dark theme background color, so that I don't have this white zone showing up when I scroll beyond the end of the page ?
I tested without success the answer to the question vuetify how to set background color.
Solution: setting <body style="background-color:black;"> in the public/index.html fie fixed the problem. Now it's just a matter of finding the color matching the dark background of vuetify.
Vuetify changes the background color of v-app based on dark mode.
You could use a watcher on Vuetify's dark mode ($vuetify.theme.isDark) that sets the body's background color to match that of the v-app:
Add a template ref to the v-app component (named "app"):
<v-app ref="app">
👆
Add a watcher on Vuetify's $vuetify.theme.isDark property that copies the v-app's background color to the body. The v-app's background color takes effect in the next render cycle, so query it in $nextTick():
export default {
watch: {
'$vuetify.theme.isDark'() {
this.$nextTick(() => {
const rootStyles = window.getComputedStyle(this.$refs.app.$el)
document.body.style.backgroundColor = rootStyles.backgroundColor
})
}
}
}
GitHub demo
I want to change the sidebar width in docusaurus, I am only allowed to change the width of sidebar in a particular page.Can anyone suggest me a solution
In version ~2.0.0 you can create your own CSS files (/src/css/custom.css) by defining it in the docusaurus.config.js. There you can set your override styles. When inspecting the page, there's Docusaurus sets the variable for --doc-sidebar-width: 300px; I was able to override that variable with an !important:
:root {
--doc-sidebar-width: 250px !important;
}
I am tring to set my buttons with vuetify but, I don't want each time to set the background color and the style of the button, or with any other vuetify component.
what is the best practice to set global style for the component like buttons chips avatar ect...
i now i can create my own component for that but then there is no reason using vuetify.
I have a nuxt project but the same apply to vue
Might be not the best practice, but this is how I'm doing it:
Create file for your global style (e.g. main.scss) In your assets folder.
Plug it in nuxt.config.js as so: css: ["~assets/styles/main.scss"]
Add class to your app root element (e.g. in default layout)
Create _vuetify.scss for overwriting Vutify styles and import it in main.scss
Write your Vuetify styles in scope of app root class for gaining selector weight.
.app .v-toolbar {
background-color: red; }
If this is too much, or as a quick solution you can just write your global styles in default layout, scoping with app root class.
I need to change the background-colour of the cancel-button with rgb. The only half-way up to now is changing the cancel-variant to e.g danger. However, I need to choose the specific, rgb colour. Does anyone know a solution to my problem?
Thank you
<b-modal v-bind:id="'delete-modal-' + id" cancel-variant=info ok-variant=danger ok-title="delete" cancel-title="back" #ok="deleteModal" title="Caution">
<p class="my-4">Are you sure?</p>
</b-modal>
If you're using SASS you can easily add new variants to your project by adding them to the $theme-colors map.
These will automatically become available to use with bootstrap-vue everywhere you can use a variant.
custom.scss
$theme-colors: (
"cancel": rgb(139, 80, 80)
);
#import 'node_modules/bootstrap/scss/bootstrap';
#import 'node_modules/bootstrap-vue/src/index.scss';
Then import custom.scss in your apps entry point.
If you want a simple CSS solution, the cancel-variant property just adds the class btn-* where * is the string you provide.
Which means you can add the css below to your global stylesheet, to add a new variant (however, doing it this way you'll have to write all the :hover, :active stuff yourself)
.btn-cancel {
color: #fff;
background-color: rgb(213, 213, 213);
border-color: rgb(213, 213, 213);
}
After adding one of the options above you will now have the option to do <b-modal cancel-variant="cancel"></b-modal> to utilize your new variant.
In elementUI the default background-color is white ; when choosing the them:dark , it is black, but how can I customise the bg-color by myself?
I have tried to add the style property at the el-menu tag , but it didn't work
<el-menu style="{background-color: rgb(36,36,36)!important}"
I try to find the source code of the css file of el-menu tag and I try to change some setting relating to background-color, don't work either
the menu component just like
somebody told me I can code like this
<el-menu style="{backgroundColor: yello}.." but it didn't work
The class for that particular element is not modifiable, have a look:
:class="{
'el-menu--horizontal': mode === 'horizontal',
'el-menu--dark': theme === 'dark',
'el-menu--collapse': collapse
}"
So your choices are:
Wrap it in a custom <div class="my-specific-selector and target it with .my-specific-selector .el-menu
Override the CSS for the dark theme
Copy + paste contents of component into your own file, adjust accordingly, use that instead.
you can try put background color directly like this
<el-menu
background-color="#304156"
text-color="#bfcbd9"
active-text-color="#409EFF"
style="height: 61px;"
></el-menu>