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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Add 1px white outline around elements on dithered sidebar (S/W Pebble) for increased legibility and clarity #109

Open
trashbytes opened this issue Nov 19, 2017 · 7 comments

Comments

@trashbytes
Copy link

trashbytes commented Nov 19, 2017

Hi!

Have a look at this comparison (imgur) I just threw together in Photoshop.
I think adding a 1px white outline around the elements in the dithered sidebar would greatly increase the legibility.

What do you guys think?

@trashbytes trashbytes changed the title Suggestion: Add 1px white border around elements on dithered sidebar (S/W Pebble) for increased legibility and clarity Suggestion: Add 1px white outline around elements on dithered sidebar (S/W Pebble) for increased legibility and clarity Nov 19, 2017
@plarus
Copy link
Collaborator

plarus commented Nov 19, 2017

It seems difficult with Pebble graphics API...
Do you know if this was already done in a Pebble watch app?

@trashbytes
Copy link
Author

trashbytes commented Nov 19, 2017

Take a look at a clone of TimeStyle called "Sidebar". It looks like he is doing something similar, although not quite as crisp as my mockup. Seems like he is using a 2px outline with rounded corners, my example is 1px outline with sharp corners. Also he uses white fonts with dark outlines.

The simplest I could think of would be to duplicate the image behind it, make it white and move it 1px in every direction.

I've demonstrated something like this in this JSFiddle using text shadows. I have no idea however what that would be in terms of drawing calls and needed extra computation power.

@plarus
Copy link
Collaborator

plarus commented Nov 19, 2017

@Spitemare who made this "sidebar" watchface may tell us how he has done this change from timestyle app.

Yes this can be done for images. But texts and numbers are not pictures but fonts. As the app is not made in html we cannot do what you made with CSS styles.

@trashbytes
Copy link
Author

Yes, I am certainly aware that there is no CSS but it would be possible to render the font several times with an offset (1px in every of the 8 directions plus the center in black) to achieve the same result. Alternatively one could create image resources to get the same look but that doesn't seem right..

@dmorgan81
Copy link
Contributor

dmorgan81 commented Nov 20, 2017

I did it in Sidebar just like @trashbytes said: I draw the font in the outline color multiple times, offset by two pixels in eight directions. Then I draw the font in the foreground color right in the center.

static inline void prv_draw_outline_text(GContext *ctx, GFont font, char *s, GRect bounds, GPoint offset) {
    graphics_draw_text(ctx, s, font, GRect(bounds.origin.x + offset.x, bounds.origin.y + offset.y, bounds.size.w, bounds.size.h),
        GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL);
}

void graphics_draw_outline_text(GContext *ctx, GFont font, char *s, GRect bounds, GColor outline_color, GColor text_color) {
    graphics_context_set_text_color(ctx, outline_color);
    prv_draw_outline_text(ctx, font, s, bounds, GPoint(2, 0));
    prv_draw_outline_text(ctx, font, s, bounds, GPoint(-2, 0));
    prv_draw_outline_text(ctx, font, s, bounds, GPoint(0, 2));
    prv_draw_outline_text(ctx, font, s, bounds, GPoint(0, -2));
    prv_draw_outline_text(ctx, font, s, bounds, GPoint(1, 1));
    prv_draw_outline_text(ctx, font, s, bounds, GPoint(-1, -1));
    prv_draw_outline_text(ctx, font, s, bounds, GPoint(1, -1));
    prv_draw_outline_text(ctx, font, s, bounds, GPoint(-1, 1));
    graphics_context_set_text_color(ctx, text_color);
    prv_draw_outline_text(ctx, font, s, bounds, GPoint(0, 0));
}

Here is how it looks if you comment out the last call to prv_draw_outline_text():
pebble_screenshot_2017-11-20_08-05-58

You can see that the outline text by itself is just a chunky blob. Putting the foreground text over it gives the illusion of outlined text.

Thankfully this works pretty well for the system Gothic font. Some other fonts don't get as good of an effect.

I did not try this on the time font since it's drawn using pebble-fctx, just like TimeStyle does. The same technique might work but it could have some weird side effects during a timeline peek.

@trashbytes
Copy link
Author

trashbytes commented Nov 20, 2017

Thank you, Spitemare, for tuning in.

I just opened PS again and didn't use the layer styles this time. I just duplicated the sidebar contents 4 times behind itself and made them white. Then moved each layer so that each of them ended up being either one pixel north-west, south-west, north-east or south-east and the result is exactly the same, so I think 4 copies should be enough, if we only want a 1px outline, at least with this kind of font.

@tilden
Copy link
Member

tilden commented Nov 20, 2017

Interesting! That probably would improve readability.

BTW @Spitemare: If you want your sidebar icons to look more like the "real" timeline ones with thinner border lines, you need to modify the svg2pdc script to pass the "precise = True" parameter when running it.

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

4 participants