Skip to content

Commit

Permalink
Renamed repo-img- to only- to allow setting images for only one t…
Browse files Browse the repository at this point in the history
…heme (alshedivat#2886)

Closes alshedivat#930.

We already had classes for this kind of feature, but it was used
specifically for repository information. Just renamed the classes so it
is clear how they can be used.

To use them with markdown, just do it like this:

```markdown
![Only light](assets/img/prof_pic_color.png){: .only-light}
![Only dark](assets/img/prof_pic.jpg){: .only-dark}
```

and with html:

```html
<img
  class="only-light"
  src="assets/img/prof_pic_color.png"
>
<img
  class="only-dark"
  src="assets/img/prof_pic.jpg"
>
```

Signed-off-by: George Araújo <george.gcac@gmail.com>
  • Loading branch information
george-gca authored and raishish committed Dec 15, 2024
1 parent 344713e commit 5ca4efe
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions _includes/repository/repo.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
<div class="repo p-2 text-center">
<a href="https://github.com/{{ include.repository }}">
<img
class="repo-img-light w-100"
class="only-light w-100"
alt="{{ include.repository }}"
src="https://github-readme-stats.vercel.app/api/pin/?username={{ repo_url[0] }}&repo={{ repo_url[1] }}&theme={{ site.repo_theme_light }}&show_owner={{ show_owner }}&description_lines_count={{ max_lines }}"
>
<img
class="repo-img-dark w-100"
class="only-dark w-100"
alt="{{ include.repository }}"
src="https://github-readme-stats.vercel.app/api/pin/?username={{ repo_url[0] }}&repo={{ repo_url[1] }}&theme={{ site.repo_theme_dark }}&show_owner={{ show_owner }}&description_lines_count={{ max_lines }}"
>
Expand Down
12 changes: 6 additions & 6 deletions _includes/repository/repo_trophies.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,38 @@
<a href="https://github.com/ryo-ma/github-profile-trophy">
<span class="d-none d-sm-none d-md-block">
<img
class="repo-img-light"
class="only-light"
alt="{{ include.username }}"
src="https://github-profile-trophy.vercel.app/?username={{ include.username }}&theme={{ site.repo_trophies.theme_light }}&locale={{ site.lang }}&margin-w=15&margin-h=15&no-bg=true&rank=-C&column=6"
>
<img
class="repo-img-dark"
class="only-dark"
alt="{{ include.username }}"
src="https://github-profile-trophy.vercel.app/?username={{ include.username }}&theme={{ site.repo_trophies.theme_dark }}&locale={{ site.lang }}&margin-w=15&margin-h=15&no-bg=true&rank=-C&column=6"
>
</span>

<span class="d-none d-sm-block d-md-none">
<img
class="repo-img-light"
class="only-light"
alt="{{ include.username }}"
src="https://github-profile-trophy.vercel.app/?username={{ include.username }}&theme={{ site.repo_trophies.theme_light }}&locale={{ site.lang }}&margin-w=15&margin-h=15&no-bg=true&rank=-C&column=4"
>
<img
class="repo-img-dark"
class="only-dark"
alt="{{ include.username }}"
src="https://github-profile-trophy.vercel.app/?username={{ include.username }}&theme={{ site.repo_trophies.theme_dark }}&locale={{ site.lang }}&margin-w=15&margin-h=15&no-bg=true&rank=-C&column=4"
>
</span>

<span class="d-block d-sm-none">
<img
class="repo-img-light"
class="only-light"
alt="{{ include.username }}"
src="https://github-profile-trophy.vercel.app/?username={{ include.username }}&theme={{ site.repo_trophies.theme_light }}&locale={{ site.lang }}&margin-w=15&margin-h=15&no-bg=true&rank=-C&column=3"
>
<img
class="repo-img-dark"
class="only-dark"
alt="{{ include.username }}"
src="https://github-profile-trophy.vercel.app/?username={{ include.username }}&theme={{ site.repo_trophies.theme_dark }}&locale={{ site.lang }}&margin-w=15&margin-h=15&no-bg=true&rank=-C&column=3"
>
Expand Down
4 changes: 2 additions & 2 deletions _includes/repository/repo_user.liquid
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<div class="repo p-2 text-center">
<a href="https://github.com/{{ include.username }}">
<img
class="repo-img-light w-100"
class="only-light w-100"
alt="{{ include.username }}"
src="https://github-readme-stats.vercel.app/api/?username={{ include.username }}&theme={{ site.repo_theme_light }}&show_icons=true"
>
<img
class="repo-img-dark w-100"
class="only-dark w-100"
alt="{{ include.username }}"
src="https://github-readme-stats.vercel.app/api/?username={{ include.username }}&theme={{ site.repo_theme_dark }}&show_icons=true"
>
Expand Down
10 changes: 6 additions & 4 deletions _sass/_themes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@
display: none;
}

.repo-img-light {
.only-light {
display: block;
}
.repo-img-dark {

.only-dark {
display: none;
}

Expand Down Expand Up @@ -111,10 +112,11 @@ html[data-theme="dark"] {
--global-danger-block-text: #600;
--global-danger-block-title: #c00;

.repo-img-light {
.only-light {
display: none;
}
.repo-img-dark {

.only-dark {
display: block;
}
}
Expand Down

0 comments on commit 5ca4efe

Please sign in to comment.