Skip to content

Commit 2b98b99

Browse files
committed
feature(new-about-prof-picture): with different themes
1 parent 2c3e7e7 commit 2b98b99

File tree

5 files changed

+41
-10
lines changed

5 files changed

+41
-10
lines changed

_layouts/about.liquid

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,30 @@ layout: default
1919
<div class="profile float-{% if page.profile.align == 'left' %}left{% else %}right{% endif %}">
2020
{% if page.profile.image %}
2121
{% assign profile_image_path = page.profile.image | prepend: 'assets/img/' %}
22+
{% assign profile_image_dark_path = page.profile.image_dark | prepend: 'assets/img/' %}
23+
2224
{% if page.profile.image_circular %}
23-
{% assign profile_image_class = 'img-fluid z-depth-1 rounded-circle' %}
25+
{% assign profile_image_class = 'img-fluid z-depth-1 rounded-circle profile-img' %}
2426
{% else %}
25-
{% assign profile_image_class = 'img-fluid z-depth-1
26-
rounded' %}
27+
{% assign profile_image_class = 'img-fluid z-depth-1 rounded profile-img' %}
2728
{% endif %}
28-
{% capture sizes %}(min-width: {{site.max_width}}) {{ site.max_width | minus: 30 | times: 0.3}}px, (min-width: 576px)
29-
30vw, 95vw"{% endcapture %}
30-
{%
31-
include figure.liquid loading="eager" path=profile_image_path class=profile_image_class sizes=sizes alt=page.profile.image
32-
cache_bust=true
33-
%}
29+
30+
{% capture sizes %}(min-width: {{site.max_width}}) {{ site.max_width | minus: 30 | times: 0.3}}px, (min-width: 576px) 30vw, 95vw"{% endcapture %}
31+
32+
<img
33+
src="{{ profile_image_path | relative_url }}"
34+
class="{{ profile_image_class }} profile-img-light"
35+
alt="profile picture"
36+
sizes="{{ sizes }}"
37+
loading="eager"
38+
>
39+
<img
40+
src="{{ profile_image_dark_path | relative_url }}"
41+
class="{{ profile_image_class }} profile-img-dark"
42+
alt="profile picture"
43+
sizes="{{ sizes }}"
44+
loading="eager"
45+
>
3446
{% endif %}
3547
{% if page.profile.more_info %}
3648
<div class="more-info">{{ page.profile.more_info }}</div>

_pages/about.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ subtitle:
66

77
profile:
88
align: right
9-
image: prof_pic.png
9+
image: prof_pic_light.png # Keep your original light theme image here
10+
image_dark: prof_pic.png
1011
image_circular: false # crops the image to make it circular
1112
more_info: >
1213
<p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p>I am Andryha</p>

_sass/_themes.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,21 @@ html[data-theme-setting="light"] {
133133
display: block;
134134
}
135135
}
136+
137+
138+
/* Default (light) theme */
139+
.profile-img-light {
140+
display: block;
141+
}
142+
.profile-img-dark {
143+
display: none;
144+
}
145+
146+
/* Dark theme */
147+
html[data-theme="dark"] .profile-img-light {
148+
display: none;
149+
}
150+
151+
html[data-theme="dark"] .profile-img-dark {
152+
display: block;
153+
}

assets/img/prof_pic.png

-437 Bytes
Loading

assets/img/prof_pic_light.png

8.95 MB
Loading

0 commit comments

Comments
 (0)