• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Changing the colour of all text on screen

Scheduled Pinned Locked Moved Troubleshooting
21 Posts 7 Posters 5.6k Views 8 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Online
    BKeyport Module Developer @boybay7
    last edited by Oct 16, 2020, 6:42 PM

    @boybay7 said in Changing the colour of all text on screen:

    @lavolp3 So just to confirm, even though I have edited code in like modules or custom.css for the font colour, it won’t be replaced when I update with git pull?

    Short answer without a bunch of confusing and unneeded parts: Yes.

    Long answer in simple form but more detail:
    These aren’t updated when you follow recommended upgrade path (usually just git pull && npm install in magicmirror directory):
    config.js
    custom.css
    modules directory structure except for the default directory tree

    There are scripts out there to stash any changes you have made to changed items, however, 99.99% of the time, changes are not needed to updated parts of the MagicMirror ecosystems. the remaining time, it’s a change to get around a short term bug (like currently, the calendar applet), that will be included in the next update, so there’s no reason to stash it.

    Bottom line - your customizations, unless done in a poor way, will never be deleted, until you rm -rf the whole mess or the boot device (Not just SD anymore!) crashes.

    If you’ve decided to customize a module within it’s own code, that isn’t a official fix of the module, I would highly recommend forking the project, switching to your fork, then modifying to your needs. Then, if you think everyone else would benefit from it, please do a merge request, and let the author(s) decide to do so, or, in the case of dead modules, change the name and take over the project (I’ve done that with MMM-Worldclock, for instance)

    The "E" in "Javascript" stands for "Easy"

    B 1 Reply Last reply Oct 17, 2020, 5:27 AM Reply Quote 1
    • B Offline
      boybay7 @lavolp3
      last edited by Oct 17, 2020, 5:20 AM

      @lavolp3 Thanks for the explanation!

      1 Reply Last reply Reply Quote 0
      • B Offline
        boybay7 @BKeyport
        last edited by Oct 17, 2020, 5:27 AM

        @BKeyport I mean when I say I’ve customised a module, I’ve changed the default fade value to false, or changed the time format on clock to 12 hour. Also I don’t know what forking the project means. But thank you also for the explanation.

        S B 2 Replies Last reply Oct 17, 2020, 11:47 AM Reply Quote 0
        • S Offline
          sdetweil @boybay7
          last edited by Oct 17, 2020, 11:47 AM

          @boybay7 the question is, did u edit the module source file (wrong way), or add parameters to the config.js config for this module (right way)

          both produce the same results

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • B Online
            BKeyport Module Developer @boybay7
            last edited by Oct 17, 2020, 5:35 PM

            @boybay7 “Fork” a procedure on github to make a copy of the code under your own username so you can make changes to the code without worrying about messing with the original, or breaking it if you want to back off to the original easily.

            but, I understand you’re only changing the custom.css file - that’s great, best way to fix things visually!

            The "E" in "Javascript" stands for "Easy"

            1 Reply Last reply Reply Quote 0
            • B Offline
              Blauenfeldt @lavolp3
              last edited by Blauenfeldt Oct 18, 2020, 5:40 PM Oct 18, 2020, 5:30 PM

              @lavolp3 said in Changing the colour of all text on screen:

              @boybay7 said in Changing the colour of all text on screen:

              Okay another question, I want to change the colour on weather forecast. Currently it’s red and blue, but I want it to go blue (min temp) and then red (max temp), so how would I do that? Appreciate all the help

              That’s a bit more complicated, but can be done via styling.

              Without explaining too much, put that in your custom.css

              .weatherforecast tr.colored .min-temp {
                color: 'green';  
              }
              
              .weatherforecast tr.colored .max-temp {
                color: 'red';  
              }
              

              or use hex codes (like ‘#00ff00’) for any color you like.

              Thank you for that info, it helped me greatly.
              Instead of asking you to help me with every question I have.
              How do i figure out what and how I change other stuff? I want to change the color like the red, as it is more like a red tint than only the red LED being lit up. I would like to change the color of the text, as it is grey and does not work well with the pictures in the background. Same goes for the grey cloudy-sunny-raining icon, or is it a .png file?

              Edit: figured out changing color: 'red'; to color: #ff0000; did the trick.

              L 1 Reply Last reply Oct 19, 2020, 6:38 AM Reply Quote 0
              • B Offline
                Blauenfeldt
                last edited by Oct 18, 2020, 8:41 PM

                As I figured out how to change the color of the max and min temp, I still struggle with the color of the days.

                1 Reply Last reply Reply Quote 0
                • L Offline
                  lavolp3 Module Developer @Blauenfeldt
                  last edited by lavolp3 Oct 19, 2020, 6:38 AM Oct 19, 2020, 6:38 AM

                  @Blauenfeldt said in Changing the colour of all text on screen:

                  How do i figure out what and how I change other stuff? I want to change the color like the red, as it is more like a red tint than only the red LED being lit up. I would like to change the color of the text, as it is grey and does not work well with the pictures in the background.

                  If you want to change ciolors of elements, you need to find out their css class or id.
                  Move into the module.js ( or if it exists the *.njk file which is a nunjucks template and creates the html). To every element you are searching for you will hopefully find some class or id.
                  In this specific case:

                  Here is the main .js file:
                  https://github.com/MichMich/MagicMirror/tree/master/modules/default/weatherforecast
                  You can of course also look into your local cloned folder /modules/default/weatherforecast/weatherforecast.js

                  Now let’s find the elements you were looking for. They are often (not always!) created in a document.createElement()function inside the getDom()-function:

                  Look it this

                  			var dayCell = document.createElement("td");
                  			dayCell.className = "day";
                  			dayCell.innerHTML = forecast.day;
                  			row.appendChild(dayCell);
                  

                  Here you find the creation of the day cell in every forecast row. They have a class called “day”.
                  Now first have a look into the .css file weatherforecast.css and look if there is something referencing the .day-class.

                  There’s something in there:

                  .weatherforecast .day {
                    padding-left: 0;
                    padding-right: 25px;
                  }
                  

                  But nothing about the color.
                  You can add the color in custom.css (it would be overwritten by custom.css if it was already in here)

                  .weatherforecast .day {
                    color: 'green';
                  }
                  

                  Want to give every day another color? That’s more difficult, but possible. Google for “css nth element”. You would want to give every nth element inside the forecast table some color.

                  Want to colorize the symbols? Can be done.
                  Again, look for the symbol creation part in weatherforecast.js:

                  			var iconCell = document.createElement("td");
                  			iconCell.className = "bright weather-icon";
                  			row.appendChild(iconCell);
                  
                  			var icon = document.createElement("span");
                  			icon.className = "wi weathericon " + forecast.icon;
                  			iconCell.appendChild(icon);
                  

                  Each cell gets actually a range of classes: “wi weathericon” and the name of the forecast-icon. You find the names of the forecast items at the top of the module-code.

                  		iconTable: {
                  			"01d": "wi-day-sunny",
                  			"02d": "wi-day-cloudy",
                  			"03d": "wi-cloudy",
                  			"04d": "wi-cloudy-windy",
                  			"09d": "wi-showers",
                  			"10d": "wi-rain",
                  			"11d": "wi-thunderstorm",
                  			"13d": "wi-snow",
                  			"50d": "wi-fog",
                  			"01n": "wi-night-clear",
                  			"02n": "wi-night-cloudy",
                  			"03n": "wi-night-cloudy",
                  			"04n": "wi-night-cloudy",
                  			"09n": "wi-night-showers",
                  			"10n": "wi-night-rain",
                  			"11n": "wi-night-thunderstorm",
                  			"13n": "wi-night-snow",
                  			"50n": "wi-night-alt-cloudy-windy"
                  		}
                  	},
                  

                  Try to give the rainy ones a blue color in custom.css:

                  .weatherforecast .wi-rain,
                  .weatherforecast .wi-showers,
                  .weatherforecast .wi-night-showers,
                  .weatherforecast .wi-night-rain {
                    color: 'blue';
                  }
                  

                  Voila!

                  Same goes for the grey cloudy-sunny-raining icon, or is it a .png file?

                  The pictures are actually svg (scalable vector graphics). They can be styled as you can see above by css. They are not pictures as they get drawn in the respective element. That way you can manipulate background and color.

                  How to troubleshoot modules
                  MMM-soccer v2, MMM-AVStock

                  L 1 Reply Last reply Oct 19, 2020, 6:44 AM Reply Quote 0
                  • L Offline
                    lavolp3 Module Developer @lavolp3
                    last edited by Oct 19, 2020, 6:44 AM

                    @Blauenfeldt BTW, a more efficient way to find out an elements class or id is using the browsers dev tools on your laptop.
                    And, this guide is very helpful
                    https://forum.magicmirror.builders/topic/6808/css-101-getting-started-with-css-and-understanding-how-css-works?_=1603089835577

                    How to troubleshoot modules
                    MMM-soccer v2, MMM-AVStock

                    B 1 Reply Last reply Oct 21, 2020, 6:17 PM Reply Quote 0
                    • B Offline
                      Blauenfeldt @lavolp3
                      last edited by Oct 21, 2020, 6:17 PM

                      @lavolp3 You, my friend, are AWESOME!
                      To be honest, I just expected to giving a link, where i could read it all, like the w3schools.com.
                      You really went beyond my expectations, on how much work you would put into helping strangers.
                      I will try that. Thank you for your big help!

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 2 / 3
                      2 / 3
                      • First post
                        16/21
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy