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

DNDtoggle - Initial release #2125

Merged
merged 14 commits into from Sep 21, 2022
Merged

DNDtoggle - Initial release #2125

merged 14 commits into from Sep 21, 2022

Conversation

pebl-hank
Copy link
Contributor

The app itself seems to be working now as intended, but I am struggeling with the icon for the launcher.
Can you help me to find a conversion that works for Dark and Light mode? The icon is transparrent and basically 2 color. It always shows wrong - regardless of the settings I use in the image converter.

Comment on lines 39 to 40
// reload clocks with new theme, otherwise just wait for user to switch apps
if (Bangle.CLOCK) load(global.__FILE__);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this: we always call load() anyway in the next line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Will change that.

Comment on lines +11 to +28
switch (current) {
case 0:
bSettings.quiet = 2;
Bangle.buzz();
setTimeout('Bangle.buzz();',500);
break;
case 1:
bSettings.quiet = 0;
Bangle.buzz();
break;
case 2:
bSettings.quiet = 0;
Bangle.buzz();
break;
default:
bSettings.quiet = 0;
Bangle.buzz();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last three cases are all the same, and we always buzz, so you could just replace it with

if (current === 0) {
    bSettings.quiet = 2;
    setTimeout('Bangle.buzz();',500);
} else {
    bSettings.quiet = 0;
}
Bangle.buzz(); 

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for future use. I will make the behavior configurable.

@gfwilliams
Copy link
Member

Hi! Sorry for the delay. For the icon, you just want this?

image

So basically on a whilte background you want it black (as above) and on black, you want it white? But no other colors?

Or you say "2 color" - was part of the inner meant to be filled? Becayse I don't think it is in the source image.

I think in the image converter you want 1 bit black/white, transparent and also inverted (you want the image to show up as white in the preview).

Try:

require("heatshrink").decompress(atob("mEwwJC/AAl/Agf/AAUAgIFDwEHAofgh/g/0Ag/wj+AnwVB/EegEfEIN4nkAh+AgE8vgVBAoV4Aoce/EAgfADQIFcjwpFHYIFCnxBFJopZBn5ZCMopxFPoqJFSowA/gA="))

@pebl-hank
Copy link
Contributor Author

require("heatshrink").decompress(atob("mEwwJC/AAl/Agf/AAUAgIFDwEHAofgh/g/0Ag/wj+AnwVB/EegEfEIN4nkAh+AgE8vgVBAoV4Aoce/EAgfADQIFcjwpFHYIFCnxBFJopZBn5ZCMopxFPoqJFSowA/gA="))

This shows a totally white icon in light mode and a totally black icon in dark mode.
Actually I'd be totally fine if the inner of the image is also transparent. So technically the image is 1 color (black) with transparent background. The black should be shown as black in light mode and as white in dark mode.

@gfwilliams
Copy link
Member

This shows a totally white icon in light mode and a totally black icon in dark mode.
Are you sure? I just tried it in the emulator with g.drawImage(require("heatshrink").decompress(atob("mEwwJC/AAl/Agf/AAUAgIFDwEHAofgh/g/0Ag/wj+AnwVB/EegEfEIN4nkAh+AgE8vgVBAoV4Aoce/EAgfADQIFcjwpFHYIFCnxBFJopZBn5ZCMopxFPoqJFSowA/gA="))) and it seems to work ok for me? Black in the default light mode (basically using whatever the foreground color is)

@pebl-hank
Copy link
Contributor Author

I pushed the change and tried to re-load the app. Maybe something is cached somewhere.
It's hard to test for me. Can I somehow make a g.drawImage(require("heatshrink").decompress(atob( string with Windows out of a PNG? Otherwise I need to commit and push to wait until I can download the app from my app page.

@gfwilliams
Copy link
Member

You can just connect with https://www.espruino.com/ide/ and paste the code in on the left hand side?

Best to do a reset() first as since the draw call will use the current color, some other code might have set it up to something non-standard otherwise

@pebl-hank
Copy link
Contributor Author

It looks good when sending it through the ide. But the launcher icon doesn't look good though.

@gfwilliams
Copy link
Member

Ahh - I think I see what's happened - you have made a dndtoggle.img file.

Please can you just use the format that we do in the examples? https://github.com/espruino/BangleApps/tree/master/apps/_example_app

So app-icon.js and then evaluate:true: https://github.com/espruino/BangleApps/blob/master/apps/_example_app/metadata.json#L12

@pebl-hank
Copy link
Contributor Author

Argh. Awesome, thanks! I knew it must have been that simple. Works like a charm. Finally :)

@gfwilliams
Copy link
Member

Great - thanks!

@gfwilliams gfwilliams merged commit ba3ea4a into espruino:master Sep 21, 2022
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

Successfully merging this pull request may close these issues.

None yet

3 participants