friedow / centerpiece

Your trusty omnibox search.
MIT License
174 stars 6 forks source link

Feature request: custom colors and fonts #108

Open pinpox opened 3 months ago

pinpox commented 3 months ago

I would love to be able to configure my own colors and font. I use the same font everywhere on my system and would like to have it in the laucher aswell.

friedow commented 3 months ago

Yup, we should definetly implement that. I'd want to avoid creating an own config file or standard for that.

What would be good standards to depend on here? I was thinking GTK 3 theme for colors and the system monopace font.

What do you think @pinpox @a-kenji?

pinpox commented 3 months ago

I would actually argue setting a color value in the yaml file would be easier. Not everyone uses GTK, I just want to set foreground and background the same way I would for e.g. my terminal emulator. Also, that should be easier to implement I suppose?

a-kenji commented 3 months ago

I'd agree with @pinpox here. Only use the system monospace font, if the user opts in to it (If transparently using it there might be font issues the user doesn't know the source for)? Setting color values inside the configuration is portable, doesn't necessitate parsing a gtk3 file, that might not be there and influences different applications.

friedow commented 3 months ago

It is certainly simpler to do it that way :). Lets just do it in the config file then.

pinpox commented 1 month ago

I tried a bit to work on this, but my rust skills are limited. This works to set colors from a hex string, how would I access the values from the config that I added? If someone can give me an example I can add all the missing colors and create a PR https://github.com/friedow/centerpiece/commit/0f3bcdcf78593bd17cb358b000b91912ecfc2286

friedow commented 1 month ago

Hey @pinpox, so nice that you are working on this 🤩.

To access the settings you can just create a new instance of the settings object whereever you need it like this: https://github.com/friedow/centerpiece/blob/main/client/src/plugin/git_repositories.rs#L33 And then use the values of the settings object like this: https://github.com/friedow/centerpiece/blob/main/client/src/plugin/git_repositories.rs#L119

pinpox commented 1 month ago

Hey @pinpox, so nice that you are working on this 🤩.

To access the settings you can just create a new instance of the settings object whereever you need it like this: https://github.com/friedow/centerpiece/blob/main/client/src/plugin/git_repositories.rs#L33 And then use the values of the settings object like this: https://github.com/friedow/centerpiece/blob/main/client/src/plugin/git_repositories.rs#L119

Thank you, that got me to a working version. I opened a draft PR as there are still a few issues.

friedow commented 1 month ago

Setting custom colors has been done in https://github.com/friedow/centerpiece/pull/141. Custom fonts is still TODO :).

pinpox commented 1 month ago

Custom fonts is still TODO :).

I had a short look at how this might be done, but the font paths seem to be hardcoded. I guess a third-party library would be the way to go?

friedow commented 1 month ago

I don't think we need a third party library here. The font path is only hardcoded because we load a font which is not installed on the users system already.

I think you could just try not loading a font at all if the user sets a custom font and setting another font name here: https://github.com/friedow/centerpiece/blob/main/client/src/main.rs#L277. Since the user should have installed and loaded the custom font already we should just be able to use it.

pinpox commented 1 month ago

Work in progress PR for font settings here: https://github.com/friedow/centerpiece/pull/143