<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>LINICKX.com</title><link>https://www.linickx.com/</link><description></description><lastBuildDate>Sat, 07 Mar 2020 11:05:00 +0000</lastBuildDate><item><title>Adding Dark Mode to your website is super easy!</title><link>https://www.linickx.com/adding-dark-mode-to-your-website-is-super-easy</link><description>&lt;p&gt;Whilst tweaking my website at the beginning of the year I was surprised how easy it is to support Light Mode or Dark Mode themes. The implementation below isn't a user toggle Javascript thing, browsers now have a "media preference", that is if your iPhone, Mac or Windows 10 is setup for Light Mode then it'll prefer a lighter style and the opposite is true, if you're setup for Dark Mode then a darker style is displayed.&lt;/p&gt;
&lt;h2&gt;Example 1: Light/White Website with optional Dark Mode.&lt;/h2&gt;
&lt;p&gt;&lt;img alt="Light Example" src="/files/2020/03/light_eg.gif" /&gt;&lt;/p&gt;
&lt;p&gt;To start with, let's take &lt;a href="https://getbootstrap.com/docs/4.4/getting-started/introduction/"&gt;the initial template from bootstrap&lt;/a&gt; and add 8 lines of code (&lt;em&gt;mostly whitespace!&lt;/em&gt;) to include an optional inverted view; this is what we add...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
    @media (prefers-color-scheme: dark) {
      body {
        background-color: black;
        color: white;
      }
    }
&amp;lt;/style&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So the final page looks like this, save it as &lt;a href="/files/2020/03/light_eg.html"&gt;&lt;code&gt;light_eg.html&lt;/code&gt;&lt;/a&gt; on your desktop.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;!doctype html&amp;gt;
&amp;lt;html lang=&amp;quot;en&amp;quot;&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;!-- Required meta tags --&amp;gt;
    &amp;lt;meta charset=&amp;quot;utf-8&amp;quot;&amp;gt;
    &amp;lt;meta name=&amp;quot;viewport&amp;quot; content=&amp;quot;width=device-width, initial-scale=1, shrink-to-fit=no&amp;quot;&amp;gt;

    &amp;lt;!-- Bootstrap CSS --&amp;gt;
    &amp;lt;link rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css&amp;quot; integrity=&amp;quot;sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh&amp;quot; crossorigin=&amp;quot;anonymous&amp;quot;&amp;gt;

    &amp;lt;title&amp;gt;Hello, world!&amp;lt;/title&amp;gt;

    &amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
        @media (prefers-color-scheme: dark) {
          body {
            background-color: black;
            color: white;
          }
        }
    &amp;lt;/style&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;Hello, world!&amp;lt;/h1&amp;gt;
    &amp;lt;p&amp;gt;Example HTML from &amp;lt;a href=&amp;quot;https://getbootstrap.com/docs/4.4/getting-started/introduction/&amp;quot;&amp;gt;bootstrap&amp;lt;/a&amp;gt;

  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;By default the page will be the &lt;em&gt;normal&lt;/em&gt; bootstrap colours, dark text on a white background but if the user has setup their device in Dark Mode the site will be white text on a black background.&lt;/p&gt;
&lt;h2&gt;Example 2: Dark/Black Website with optional Light Mode.&lt;/h2&gt;
&lt;p&gt;&lt;img alt="Dark Example" src="/files/2020/03/dark_eg.gif" /&gt;&lt;/p&gt;
&lt;p&gt;Ok, so what if your use case was the same as mine; your site is normally dark but you want to provide a brighter version for people who prefer the lighter side of the net.&lt;/p&gt;
&lt;p&gt;This time, lets start with the full HTML example: &lt;a href="/files/2020/03/dark_eg.html"&gt;&lt;code&gt;dark_eg.html&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;!doctype html&amp;gt;
&amp;lt;html lang=&amp;quot;en&amp;quot;&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;!-- Required meta tags --&amp;gt;
    &amp;lt;meta charset=&amp;quot;utf-8&amp;quot;&amp;gt;
    &amp;lt;meta name=&amp;quot;viewport&amp;quot; content=&amp;quot;width=device-width, initial-scale=1, shrink-to-fit=no&amp;quot;&amp;gt;

    &amp;lt;!-- Bootswatch CSS --&amp;gt;

    &amp;lt;link href=&amp;quot;https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/cyborg/bootstrap.min.css&amp;quot; rel=&amp;quot;stylesheet&amp;quot; integrity=&amp;quot;sha384-l7xaoY0cJM4h9xh1RfazbgJVUZvdtyLWPueWNtLAphf/UbBgOVzqbOTogxPwYLHM&amp;quot; crossorigin=&amp;quot;anonymous&amp;quot;&amp;gt;

    &amp;lt;title&amp;gt;Hello, world!&amp;lt;/title&amp;gt;

    &amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
        @media (prefers-color-scheme: light) {
          body, h1, h2, h3 {
            background-color: white;
            color: black;
          }
        }
    &amp;lt;/style&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;Hello, world!&amp;lt;/h1&amp;gt;
    &amp;lt;p&amp;gt;Example HTML from &amp;lt;a href=&amp;quot;https://getbootstrap.com/docs/4.4/getting-started/introduction/&amp;quot;&amp;gt;bootstrap&amp;lt;/a&amp;gt; with dark &amp;lt;a href=&amp;quot;https://bootswatch.com/cyborg/&amp;quot;&amp;gt;Cyborg Theme&amp;lt;/a&amp;gt;

  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this example we're using &lt;a href="https://bootswatch.com/cyborg"&gt;a dark bootstrap theme called cyborg&lt;/a&gt;, again we add in our 8 lines, but notice something a little different:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
    @media (prefers-color-scheme: light) {
      body, h1, h2, h3 {
        background-color: white;
        color: black;
      }
    }
&amp;lt;/style&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the dark example, additional changes are needed for &lt;code&gt;h1&lt;/code&gt;, &lt;code&gt;h2&lt;/code&gt; &amp;amp; &lt;code&gt;h3&lt;/code&gt; so this is the gotcha to look out for when using off-the-shelf themes. In the cyborg theme, the headings do not inherited their colour from body, they are hard set; when the colour scheme is inverted the white on white text disappears. To fix the issue some additional &lt;code&gt;h1&lt;/code&gt;, &lt;code&gt;h2&lt;/code&gt; &amp;amp; &lt;code&gt;h3&lt;/code&gt; colours are needed, so make sure you test your site in each mode to capture any missing options.&lt;/p&gt;
&lt;h3&gt;Footnotes&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;This feature isn't dependent on bootstrap, it simply makes a good example as it's a style/css framework that's very common.&lt;/li&gt;
&lt;li&gt;User's cannot &lt;em&gt;choose&lt;/em&gt; a theme, this approach simply honours their system wide preference&lt;/li&gt;
&lt;li&gt;Inspired by Flavio's dark mode post: https://flaviocopes.com/dark-mode/&lt;/li&gt;
&lt;/ul&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nick Bettison</dc:creator><pubDate>Sat, 07 Mar 2020 11:05:00 +0000</pubDate><guid isPermaLink="false">tag:www.linickx.com,2020-03-07:adding-dark-mode-to-your-website-is-super-easy</guid><category>Design</category><category>CSS</category></item><item><title>Thoughts on my website</title><link>https://www.linickx.com/thoughts-on-my-website</link><description>&lt;p&gt;I've been wondering lately if &lt;a href="https://www.linickx.com"&gt;linickx.com&lt;/a&gt;
needs a more minimalist touch, something like the &lt;a href="http://zeitgeist.geekyogre.com/"&gt;Gnome Zeitgeist
blog&lt;/a&gt; or
&lt;a href="http://thpinfo.com/"&gt;thpinfo.com&lt;/a&gt;, getting the balance right in my
themes is always a problem for me. If I can find some time I think I'll
have a play.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nick</dc:creator><pubDate>Tue, 15 Sep 2009 20:57:00 +0100</pubDate><guid isPermaLink="false">tag:www.linickx.com,2009-09-15:thoughts-on-my-website</guid><category>Blog</category><category>design</category><category>linickx.com</category><category>thoughts</category></item><item><title>UGHRRG, ie6!!!! Should I support it?</title><link>https://www.linickx.com/ughrrg-ie6-should-i-support-it</link><description>&lt;p&gt;I'm in the process the process of writing a whole new look for
linickx.com, I think I'm about there so I've decided it was about time
to give the other browsers a spin. All of my development has been with
Firefox on linux (&lt;em&gt;with a little
&lt;a href="http://www.gnome.org/projects/epiphany/"&gt;epiphany&lt;/a&gt; for testing non
logged in users&lt;/em&gt;) and I've got the look and feel pretty much as I like.&lt;/p&gt;
&lt;p&gt;I reboot into windows cause according to google analytics 70% of my
visitors in the last month are windows people; Firefox on windows passes
the test, all the same, so I've downloaded a copy of safari for windows,
good news there too and I finish off with Internet Explorer 6, crap I
forgot that ie6 cannot render transparent .png files, although the
layout is alright my new header is screwed and I've used .png icons in
my /files/ section so that's going to look rubbish.&lt;/p&gt;
&lt;p&gt;This leaves me with a dilemma, do I re-do all of my images as .gifs to
account for the 10% of ie6 users? And is it possible to dual install ie6
&amp;amp; ie7 ? ... I still haven't tested that and 20% of visitors use
that...I've never bothered upgrading to ie7 since I new I was never
going to use it, why waste the disk space &amp;amp; bandwidth?&lt;/p&gt;
&lt;p&gt;I'm toying with having a &lt;a href="http://browsehappy.com/"&gt;browse happy&lt;/a&gt; banner
appear for ie6 and a disclaimer saying this site will look awful use a
proper browser; the banner will be easy to do within the WordPress
powered section, but the /files/ section which is driven by apache may
be more of an issue.&lt;/p&gt;
&lt;p&gt;The whole thing is just irritating, I was really looking forward to
getting the new look up soon, ho-hum off to make a decision!&lt;/p&gt;
&lt;p&gt;P.s. In case you were wondering, yes 60% of vistors are firefox, 5% are
safari and the other 5% is made up of random stuff (&lt;em&gt;hello to the 2
users on the PSP!!!&lt;/em&gt;)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nick</dc:creator><pubDate>Sun, 20 Apr 2008 12:25:00 +0100</pubDate><guid isPermaLink="false">tag:www.linickx.com,2008-04-20:ughrrg-ie6-should-i-support-it</guid><category>design</category><category>Firefox</category><category>internet explorer</category></item></channel></rss>