where do I find theme settings?

Posted on
  • I know that I can find the current general settings using

      let Settings = require('Storage').readJSON('setting.jso­n', true) || {};
      print('Settings',Settings);
    

    but where do I find details of the currently configured theme?

    The documentation tells us to look into a file called settings.js which sounds strange on one hand and does not exist on the other...

  • I guess that refers to the file on Github. Take a look at https://github.com/espruino/BangleApps/b­lob/d9d5926416566762e59b953c745f989d23c9­b334/apps/setting/settings.js#L214

    For the currently used theme just use g.theme. That will spit out a JSON array.

  • Thanks for your response.

    What I am currently looking for is a place where a global theming could be defined.

    Right now, everything seems to render black on white - but what if I would like to have it the other way round (white on black)? Where could I configure such a theme?

  • While global settings may not include an explicit configuration for a global theme, you may still set one which is from then on respected in any apps (unless they override any theme settings):

      let customTheme = {
        fg:g.toColor(0,0,0), fg2:g.toColor(0,0,1), fgH:g.toColor(0,0,0),
        bg:g.toColor(0,1,0), bg2:g.toColor(0,1,0), bgH:g.toColor(1,1,0)
      };
      let globalSettings = Object.assign(
        require('Storage').readJSON('setting.jso­n', true) || {},
        { theme:customTheme }
      );
      require('Storage').writeJSON('setting.js­on', globalSettings);
    

    It is important, however, that you use g.toColor in order to get the proper color values for the Bangle.js 2!

  • g.theme holds the value of the apps active theme.

  • I know, but I want to set a theme globally!

  • To set it globally go into the settings App, under System, select Theme.

    There are 2 themes defined, a black on white and a white on black.
    You can them customise the actual settings on one of more of the attribute.
    In that way you can define you own theme.


    1 Attachment

    • download (2).png
  • Great! thank you!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

where do I find theme settings?

Posted by Avatar for Andreas_Rozek @Andreas_Rozek

Actions