If you're using Redux, you can use redux-persist npm i redux-persist
which uses localstorage as Hoargarth suggested. The difference being you don't have to manage the setting and getting of the key-value in the browser, instead, define your color props in your reducer and dispatch an action to update it with your button handler and redux-persist will manage persisting your state after refresh and closing the browser.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…