0

How to change Buttons color in Magento2?

3 Answers 3

5

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.

1
0

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

-3

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

3
  • Is it then the intension for global style overrides that we edit the content of that dir?
    – circlesix
    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.
    – Zankar
    Commented Mar 12 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.