From 898c6f7a21c926238e4685392149842dea1cf321 Mon Sep 17 00:00:00 2001 From: abhay-ahirkar Date: Sun, 26 Mar 2023 00:12:35 +0530 Subject: [PATCH 1/6] added theme change feature --- _data/themes.yml | 6 ++++++ _includes/head.html | 19 ++++++++++++++++++- _includes/header.html | 2 ++ _includes/theme-switcher.html | 8 ++++++++ css/dark_theme.css | 21 +++++++++++++++++++++ css/default_theme.css | 21 +++++++++++++++++++++ css/light_theme.css | 21 +++++++++++++++++++++ 7 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 _data/themes.yml create mode 100644 _includes/theme-switcher.html create mode 100644 css/dark_theme.css create mode 100644 css/default_theme.css create mode 100644 css/light_theme.css diff --git a/_data/themes.yml b/_data/themes.yml new file mode 100644 index 0000000..0ed3f43 --- /dev/null +++ b/_data/themes.yml @@ -0,0 +1,6 @@ +- name: "Default" + url: "/css/style.css" +- name: "Dark" + url: "/css/dark.css" +- name: "Light" + url: "/css/light.css" diff --git a/_includes/head.html b/_includes/head.html index 0604854..1d5cb31 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -3,6 +3,7 @@ templated.co @templatedco Released for free under the Creative Commons Attribution 3.0 license (templated.co/license) --> + {% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %} @@ -14,10 +15,26 @@ + + + + {% include analytics.html %} - + \ No newline at end of file diff --git a/_includes/header.html b/_includes/header.html index 374f933..53ccdf3 100644 --- a/_includes/header.html +++ b/_includes/header.html @@ -14,6 +14,8 @@
  • {{ page.title }}
  • {% endif %} {% endfor %} + {% include theme-switcher.html %} + diff --git a/_includes/theme-switcher.html b/_includes/theme-switcher.html new file mode 100644 index 0000000..d892fae --- /dev/null +++ b/_includes/theme-switcher.html @@ -0,0 +1,8 @@ +{% assign themes = site.data.themes %} +{% if themes %} +
    + {% for theme in themes %} + {{ theme.name }} + {% endfor %} +
    +{% endif %} diff --git a/css/dark_theme.css b/css/dark_theme.css new file mode 100644 index 0000000..a2b5d71 --- /dev/null +++ b/css/dark_theme.css @@ -0,0 +1,21 @@ +body { + background-color: #333; + color: #fff; + } + + a { + color: #0cf; + } + + h1, h2, h3, h4, h5, h6 { + color: #fff; + } + + .container { + max-width: 960px; + margin: 0 auto; + padding: 0 15px; + } + + /* Other styles go here... */ + \ No newline at end of file diff --git a/css/default_theme.css b/css/default_theme.css new file mode 100644 index 0000000..4a31f88 --- /dev/null +++ b/css/default_theme.css @@ -0,0 +1,21 @@ +body { + background-color: #f5f5f5; + color: #333; + } + + a { + color: #007bff; + } + + h1, h2, h3, h4, h5, h6 { + color: #333; + } + + .container { + max-width: 960px; + margin: 0 auto; + padding: 0 15px; + } + + /* Other styles go here... */ + \ No newline at end of file diff --git a/css/light_theme.css b/css/light_theme.css new file mode 100644 index 0000000..f75ae5f --- /dev/null +++ b/css/light_theme.css @@ -0,0 +1,21 @@ +body { + background-color: #fff; + color: #333; + } + + a { + color: #007bff; + } + + h1, h2, h3, h4, h5, h6 { + color: #333; + } + + .container { + max-width: 960px; + margin: 0 auto; + padding: 0 15px; + } + + /* Other styles go here... */ + \ No newline at end of file From 5c2482bccd6f942bcf60aeab727dc26471139d16 Mon Sep 17 00:00:00 2001 From: abhay-ahirkar Date: Sun, 26 Mar 2023 00:17:06 +0530 Subject: [PATCH 2/6] checked From 5724d0aeabaa0a8397cdbf9f5a32696d9c3fc0ea Mon Sep 17 00:00:00 2001 From: abhay-ahirkar <127684179+abhay-ahirkar@users.noreply.github.com> Date: Sun, 26 Mar 2023 00:33:19 +0530 Subject: [PATCH 3/6] Create Gemfile --- Gemfile | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Gemfile diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..5761cb3 --- /dev/null +++ b/Gemfile @@ -0,0 +1,2 @@ +source "https://rubygems.org" +gem 'github-pages' From c17b3f75921eea30350c72ca0226fb89f5e76087 Mon Sep 17 00:00:00 2001 From: abhay-ahirkar <127684179+abhay-ahirkar@users.noreply.github.com> Date: Sun, 26 Mar 2023 00:34:33 +0530 Subject: [PATCH 4/6] Create .ruby-version --- .ruby-version | 1 + 1 file changed, 1 insertion(+) create mode 100644 .ruby-version diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..35cee72 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.4.3 From ee847a73008266e045ba20fadbf1fd1150fb91ce Mon Sep 17 00:00:00 2001 From: abhay-ahirkar Date: Sun, 26 Mar 2023 00:47:34 +0530 Subject: [PATCH 5/6] check --- _data/themes.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_data/themes.yml b/_data/themes.yml index 0ed3f43..3495a18 100644 --- a/_data/themes.yml +++ b/_data/themes.yml @@ -1,6 +1,6 @@ - name: "Default" - url: "/css/style.css" + url: "/css/default_theme.css" - name: "Dark" - url: "/css/dark.css" + url: "/css/dark_theme.css" - name: "Light" - url: "/css/light.css" + url: "/css/light_theme.css" From 7e842efe47b47adc551c65843b2b4bc59e360cd6 Mon Sep 17 00:00:00 2001 From: abhay-ahirkar Date: Sun, 26 Mar 2023 01:07:44 +0530 Subject: [PATCH 6/6] cheked again --- _includes/theme-switcher.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/_includes/theme-switcher.html b/_includes/theme-switcher.html index d892fae..8ccf12c 100644 --- a/_includes/theme-switcher.html +++ b/_includes/theme-switcher.html @@ -2,7 +2,8 @@ {% if themes %}
    {% for theme in themes %} - {{ theme.name }} + {{ theme.name }} + {% endfor %}
    {% endif %}