How to change Buttons
color in Magento2
?
3 Answers
I was strugglying with this too, here is what I would suggest.
Add this to your new theme _extend.less
file
@button-primary__background: <your color here >;
e.g
@button-primary__background: #ccc;
You will likely want to change the border colour to, which can be done like so :
@button-primary__border: #ccc;
I hope this helps.
-
Hi Ben, any help same issue magento.stackexchange.com/q/328933/57334 thanks.– zusCommented Jan 6, 2021 at 12:13
Override the values in your theme file, which name as _theme.less, change value as below:
@button__color: red;
@button__background: yellow;
run this command php bin/magento cache:clean
refresh your page
In Magento 2 you can edit buttons property from below path:
magento_installed_directory\lib\web\css\source\lib\variables\_buttons.less
flush your cache
-
Is it then the intension for global style overrides that we edit the content of that dir? Commented Dec 3, 2016 at 19:14
-
yes, you are right, we need to copy those file in our theme package, and then edit Commented Apr 4, 2017 at 7:24
-
I find this answer useful. While you can't edit files in vendor directly you can just create a file in your theme
web/css/source/_theme.less
and just override the variables there. Just use the mentioned file as a reference, or a list of defined variables, if you will.– ZankarCommented Mar 12 at 8:55