WalletConnect / web3modal

A single Web3 provider solution for all Wallets
https://web3modal.com
Apache License 2.0
4.8k stars 1.35k forks source link

Improve theming #1382

Open pociej opened 11 months ago

pociej commented 11 months ago

What problem does this new feature solve?

Currently theming provides really limited palette of options. Most important points

createWeb3Modal({
  wagmiConfig,
  projectId,
  chains,
  themeMode: 'light',
  themeVariables: {
    '--w3m-accent': 'red',
  },
})

Here are screen shots

Screenshot 2023-10-09 at 09 31 49 Screenshot 2023-10-09 at 09 31 30

Only red I see is in network switch view, really inconsistent way.

Describe the solution you'd like

I see two possible approaches here.

1) Follow something like presentational/container pattern. From the library level provide components responsible for logic and give user api to register presentational components. This is advanced and hard to use, so for sure shouldnt be default behaviour. However its best option for advanced users.

2) Extend list of properties like '--w3m-background-color', '--w3m-button-color', '--w3m-font-size' etc. This could exists in parallel with 1.

Would you be open to accept PR?

dirtycajunrice commented 10 months ago

Additional details:

luismmdev commented 10 months ago

Is the ThemeVariables interface up to date? I'm seeing different options in the docs vs the types.

types vs docs

glitch-txs commented 10 months ago

hey @luismmdev those docs are for v2 you might want to check here instead https://docs.walletconnect.com/web3modal/javascript/theming

luismmdev commented 10 months ago

hey @luismmdev those docs are for v2 you might want to check here instead https://docs.walletconnect.com/web3modal/javascript/theming

Ops, my bad, you're right, thanks!

pociej commented 9 months ago

@glitch-txs I fixed this hacking into shadow-dom css. However I would b e open to create PR here, as long as you are open to merge such a PR. What do you think?

KorbinianK commented 7 months ago

@glitch-txs I feel like the most obvious thing that is missing is simply adjusting the button size. The "disconnected" Button has two pre-configured options md and sm, with plenty of others prepared but specifically excluded.

But the connected state is fixed, no option to change the height whatsoever.

I get you want to limit certain things but I feel like using shadow parts, this could be added rather easily without having to pass specific classes through the entire codebase? That way dapps could theme certain parts more easily.

Resources: