Skip to content

Commit

Permalink
Ensure original terminal theme is respected inside iframe embeds
Browse files Browse the repository at this point in the history
  • Loading branch information
ku1ik committed May 9, 2024
1 parent 7215ca6 commit 41328c4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
13 changes: 1 addition & 12 deletions lib/asciinema_web/controllers/recording/head_for_show.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,4 @@
<meta name="referrer" content="origin" />
<% end %>

<style :for={theme <- original_theme(@asciicast)}>
/* Keep the poster theme consistent with the playback theme */
div.ap-player {
--term-color-foreground: <%= theme.fg %>;
--term-color-background: <%= theme.bg %>;
<%= for {c, i} <- theme.palette do %>
--term-color-<%= i %>: <%= c %>;
<% end %>
}
</style>
<.original_theme_style asciicast={@asciicast} />
2 changes: 2 additions & 0 deletions lib/asciinema_web/controllers/recording/iframe.html.heex
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<.original_theme_style asciicast={@asciicast} />

<div id="player" style="width: 100%"></div>

<p class="powered">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<style :for={theme <- original_theme(@asciicast)}>
/* Keep the poster theme consistent with the playback theme */
div.ap-player {
--term-color-foreground: <%= theme.fg %>;
--term-color-background: <%= theme.bg %>;
<%= for {c, i} <- theme.palette do %>
--term-color-<%= i %>: <%= c %>;
<% end %>
}
</style>

0 comments on commit 41328c4

Please sign in to comment.