Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background aware font setup #544

Closed
rytswd opened this issue Apr 29, 2024 · 4 comments
Closed

Background aware font setup #544

rytswd opened this issue Apr 29, 2024 · 4 comments

Comments

@rytswd
Copy link

rytswd commented Apr 29, 2024

Sorry if this is something sketchybar is already capable handling, I just couldn't find any mention in the documentation... 馃檱

Currently, I got most of my config setup with custom look and feel -- but for some inputs like bluetooth, audio and keyboard, I'm currently using the macOS alias instead. This is what it looks right now.
image

As you can see, the widgets from macOS have the font colour based on the wallpaper, and it renders icons in white in this case. As my wallpaper setup uses shuffled landscape, I want to be able to do a similar background-aware font colour setup. Is this supported, and if so, how would I go about that?

@FelixKratz
Copy link
Owner

I invested some time in the past to make this possible by replacing the coloring of the aliases, basically aliases have the property alias.color=<argb_hex> available to override the color.

Implementation:

SketchyBar/src/alias.c

Lines 242 to 253 in 4194da0

if (alias->color_override) {
CGContextSaveGState(context);
image_draw(&alias->image, context);
CGContextClipToMask(context, alias->image.bounds, alias->image.image_ref);
CGContextSetRGBFillColor(context,
alias->color.r,
alias->color.g,
alias->color.b,
alias->color.a );
CGContextFillRect(context, alias->image.bounds);
CGContextRestoreGState(context);

Documentation:
https://felixkratz.github.io/SketchyBar/config/components#item-alias----mirror-items-of-the-original-macos-status-bar-into-sketchybar

@rytswd
Copy link
Author

rytswd commented Apr 29, 2024

Thanks for the details, and sorry I should have clarified better -- I actually prefer the macOS colouring to be aware of the wallpaper colour, and was curious if sketchybar can have the changing colour behaviour for non-alias widgets as well.

So in the above screenshot, I want the calendar and other widgets to show up in white, if the wallpaper is rather dark. I imagine supporting something like this would be a lot of undertaking, but wanted to check if it's already implemented.

@FelixKratz
Copy link
Owner

I think you should be able to script this, see this comment:
#159 (comment)

@rytswd
Copy link
Author

rytswd commented Apr 30, 2024

Ah thank you, the regex support is something I didn't come across, I'll check more on that. The macOS behaviour I'm referring to is based on the wallpaper brightness, though -- so I'm not sure if this is something I can subscribe to. I'll do a bit more digging in the coming days and report if I can make it work as I like

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants