I do not recommend overriding _theme.less, especially since you said your are extending Luma. Depending on what your custom theme's parent is, you'd end up having to copy and paste the entire contents of the parent's _theme.less. This also causes you to miss updates that occur in the parent's _theme.less file as your override fully blocks the parent _theme.less. Future updates would be blocked and this has the potential to break static content deployment due to undefined variables.
To keep it simple and relevant to your question, do the following:
- Make sure you are in developer mode: php bin/magento deploy:mode:set developer
- When I add a new file or begin a new theme, I always like to do the following bc sometimes the file system can be stubborn, although not required: rm -rf pub/static/frontend var/view_preprocessed
Create the following files (the path is relative to your theme):
web/css/source/_extend.less. For example, the full path in my own theme is vendor/magemodule/theme-frontend-default/web/css/source/_extend.less
@import 'lib/variables/_buttons_extend';
web/css/source/lib/variables/_buttons_extend.less For example, the full path in my own theme is vendor/magemodule/theme-frontend-default/web/css/source/lib/variables/_buttons_extend.less
@button-primary__color: @color-white;
@button-primary__hover__color: @color-white;
@button-primary__background: @color-orange-red1;
@button-primary__hover__background: @color-orange-red4;
@button-primary__border: 1px solid @color-orange-red2;
@button-primary__hover__border: 1px solid @color-orange-red2;
- Clear your browser's cache. Sometimes, previous static assets (less files) are cached
- Refresh the page
If you still do not see your changes, something in your theme is happening at a lower level and causing your variables to be ignored and you'd need to investigate that. By doing it the way I described above, you are able to only include the specific variables you want to change without having to do a copy/paste/override which is something you should avoid.
Also, just to follow up on my advice for best practice, Magento does make a very similar recommendation in their dev docs: https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/css-guide/css_quick_guide_approach.html