Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dark logos #903

Merged
merged 2 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions assets/scripts/features/darkmode/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ window.addEventListener('load', async () => {

// save preference to local storage
saveScheme(newScheme)

setImages(newScheme)
}

setScheme(loadScheme())
Expand All @@ -50,3 +52,19 @@ window.addEventListener('load', async () => {
})
})
})

function setImages(newScheme) {
const els = Array.from(document.getElementsByClassName('logo-holder'));
for (const el of els) {
const light = el.querySelector('.light-logo');
const dark = el.querySelector('.dark-logo');
if (newScheme === "dark" && dark !== null) {
if (light !== null) light.style.display = 'none'
dark.style.display = 'inline'
}
else {
if (light !== null) light.style.display = 'inline'
if (dark !== null) dark.style.display = 'none'
}
}
}
8 changes: 6 additions & 2 deletions layouts/partials/sections/education-alt.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ <h1 class="text-center" style="display: none">
<div class="degree-info card">

{{ $logoImage:= resources.Get .institution.logo}}
{{ $darkLogoImage:= resources.Get .institution.darkLogo}}
{{ if $logoImage }}
<div class="logo-holder">
<img class="company-logo" src="{{ $logoImage.RelPermalink }}" alt="{{ .name }}" />
<div class="logo-holder">
<img class="company-logo light-logo" src="{{ $logoImage.RelPermalink }}" alt="{{ .name }}" />
{{ if $darkLogoImage }}
<img class="company-logo dark-logo" src="{{ $darkLogoImage.RelPermalink }}" alt="{{ .name }}" />
{{ end }}
</div>
{{ end }}

Expand Down
8 changes: 6 additions & 2 deletions layouts/partials/sections/education.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ <h1 class="text-center" style="display: none">
<div class="degree-info card">

{{ $logoImage:= resources.Get .institution.logo}}
{{ $darkLogoImage:= resources.Get .institution.darkLogo}}
{{ if $logoImage }}
<div class="logo-holder">
<img class="company-logo" src="{{ $logoImage.RelPermalink }}" alt="{{ .name }}" />
<div class="logo-holder">
<img class="company-logo light-logo" src="{{ $logoImage.RelPermalink }}" alt="{{ .name }}" />
{{ if $darkLogoImage }}
<img class="company-logo dark-logo" src="{{ $darkLogoImage.RelPermalink }}" alt="{{ .name }}" />
{{ end }}
</div>
{{ end }}

Expand Down
12 changes: 8 additions & 4 deletions layouts/partials/sections/experiences/positions.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<div class="col-10 col-lg-8">
<div class="experience-entry-heading">
{{ $logoImage:= resources.Get .company.logo}}
{{ if $logoImage }}
<div class="logo-holder">
<img class="company-logo" src="{{ $logoImage.RelPermalink }}" alt="{{ .name }}" />
</div>
{{ $darkLogoImage:= resources.Get .company.darkLogo}}
{{ if $logoImage }}
<div class="logo-holder">
<img class="company-logo light-logo" src="{{ $logoImage.RelPermalink }}" alt="{{ .name }}" />
{{ if $darkLogoImage }}
<img class="company-logo dark-logo" src="{{ $darkLogoImage.RelPermalink }}" alt="{{ .name }}" />
{{ end }}
</div>
{{ end }}
<!-- Total experience duration on a company is time between the starting date of the oldest position and ending date of most recent position -->
{{ $oldestPosition := index (last 1 .positions) 0}}
{{ $mostRecentPosition := index (first 1 .positions) 0}}
Expand Down
Loading