Skip to content

Fixes in ability to apply a dark theme only to the log viewer #87

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

Merged
merged 3 commits into from
Dec 4, 2024

Conversation

dlabaj
Copy link
Collaborator

@dlabaj dlabaj commented Dec 3, 2024

Updated code to add the ability to always apply a dark theme to the log viewer.

https://issue82-logviewer.surge.sh

@dlabaj dlabaj linked an issue Dec 4, 2024 that may be closed by this pull request
Copy link

@andrew-ronaldson andrew-ronaldson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfecto

Copy link

@mcoker mcoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Though I'll mention that I think you can clean this up a little - I tested this quickly in dev tools and it seemed to work OK. You could try making changes to this block

.pf-v6-c-log-viewer.pf-m-dark {
--pf-v6-c-log-viewer__main--BorderWidth: var(--pf-v6-c-log-viewer--m-dark__main--BorderWidth);
}
html:not(.pf-v6-theme-dark) .pf-v6-c-log-viewer.pf-m-dark .pf-v6-c-log-viewer__main {
--pf-v6-c-log-viewer__main--BackgroundColor: var(--pf-v6-c-log-viewer--m-dark__main--BackgroundColor);
--pf-v6-c-log-viewer__main--BorderColor: var(--pf-t--global--border--color--default);
--pf-v6-c-log-viewer__text--Color: var(--pf-v6-c-log-viewer--m-dark__text--Color);
--pf-v6-c-log-viewer__index--Color: var( --pf-v6-c-log-viewer--m-dark__index--Color);
--pf-v6-c-log-viewer--m-line-numbers__list--before--BackgroundColor: var(--pf-t--global--border--color--default);
}

html:not(.pf-v6-theme-dark) .pf-v6-c-log-viewer.pf-m-dark { 
  --pf-v6-c-log-viewer__main--BorderWidth: var(--pf-v6-c-log-viewer--m-dark__main--BorderWidth);
  --pf-v6-c-log-viewer__main--BackgroundColor: var(--pf-v6-c-log-viewer--m-dark__main--BackgroundColor); 
  --pf-v6-c-log-viewer__text--Color: var(--pf-v6-c-log-viewer--m-dark__text--Color); 
  --pf-v6-c-log-viewer__index--Color: var( --pf-v6-c-log-viewer--m-dark__index--Color); 
}

The changes are:

  • Moves --pf-v6-c-log-viewer__main--BorderWidth: var(--pf-v6-c-log-viewer--m-dark__main--BorderWidth) into the block with html:not(.pf-v6-theme-dark) so the border is only removed in the dark log viewer in PF's light theme. Currently in this PR the dark log viewer in PF's dark mode is removing this border, which I'm assuming we don't want
  • Removes --pf-v6-c-log-viewer__main--BorderColor: var(--pf-t--global--border--color--default). That declaration is redeclaring the log viewer var with the same token value as it was originally defined, so it isn't doing anything.
  • Removes --pf-v6-c-log-viewer--m-line-numbers__list--before--BackgroundColor: var(--pf-t--global--border--color--default) for the same reason as the previous bullet.
  • Removes .pf-v6-c-log-viewer__main from the selector for the dark theme overrides. Typically these modifications are best made at the top-level component selector (eg, .pf-v6-c-log-viewer). It isn't always possible, depending on the override, but it should work fine here.

Copy link

@mcoker mcoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nailed it! 🐸

@dlabaj dlabaj merged commit 9700620 into patternfly:main Dec 4, 2024
7 checks passed
Copy link

github-actions bot commented Dec 4, 2024

🎉 This PR is included in version 6.1.0-prerelease.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PF6 - dark theme toggle in docs not toggling
4 participants