Closed Bug 1586529 Opened 5 years ago Closed 2 years ago

Make "View Source" page follow system dark theme

Categories

(Toolkit :: View Source, enhancement, P3)

71 Branch
enhancement

Tracking

()

VERIFIED FIXED
98 Branch
Tracking Status
firefox98 --- verified

People

(Reporter: wjmacfarland, Assigned: aminomancer, NeedInfo)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0

Steps to reproduce:

Developed dark theme option for the "View Source" page. This allows the user to toggle between the default (light) and new (dark) theme style sheets. The option is serialized on exit and restored in the same manner as the existing options and the last used setting is used when creating a new tab. For performance reasons, I modified the C++ code to remove the default link (stylesheet) element from being attached to the head of the View Source page. Javascript is then employed to add the correct stylesheet upon creation of the page. Similar to the word wrapping and syntax highlighting, a class is added to the body for the dark theme setting which the JS code then uses to affix the proper stylesheet to the head.

Actual results:

https://imgur.com/a/oAtOB3p

Attached patch moz_central_dark_theme (obsolete) — Splinter Review

no test code yet, waiting on approval.

I wil set a component for this enhancement. We wait for a response from dev's team side if the option "Use Dark Theme" should be added below the "Syntax Highlighting".
Regards,
Liviu

Status: UNCONFIRMED → NEW
Component: Untriaged → View Source
Ever confirmed: true
Product: Firefox → Toolkit

Thanks for reporting! I don't think the patch that's attached in the right one. Do you have the right one by any chance ?

This is something we'd approve, but making it follow the system setting (@media (prefers-color-scheme: dark) rather than a separate setting).

Flags: needinfo?(wjmacfarland)

Also, making it use @media (prefers-color-scheme: dark) means that this would be purely CSS, and wouldn't require writing tests.

Summary: How to contribute new feature: "View Source" page dark theme option → Make "View Source" page follow system dark theme
Attachment #9099055 - Attachment is obsolete: true

Basing it only on prefers-color-scheme (without any setting/override) incurs the disadvantages of robbing the user of control (bug 565512) in cases where they desire a different color scheme in view-source and of making this feature currently (and for the foreseeable future?) broken and unusable if privacy.resistFingerprinting is on (bug 1535189, bug 1588548, bug 1401440, ...).

(In reply to vagmer from comment #7)

Basing it only on prefers-color-scheme (without any setting/override) incurs the disadvantages of robbing the user of control (bug 565512) in cases where they desire a different color scheme in view-source and of making this feature currently (and for the foreseeable future?) broken and unusable if privacy.resistFingerprinting is on (bug 1535189, bug 1588548, bug 1401440, ...).

That seems okay. The resistFingerprinting issue should be addressed more broadly. We're not going to add UI to work around this only for view-source.

Just dropping a patch I had. This works well for the view-source page, but breaks the XML prettyprinting one...

Assignee: nobody → shmediaproductions
Status: NEW → ASSIGNED

Hi! Should this be change be landed?

Flags: needinfo?(shmediaproductions)

Yeah I don't have any further changes. Thanks

Flags: needinfo?(shmediaproductions)
Pushed by evilpies@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/14d0c71acebc
Make viewsource and XMLPrettyPrint adapt to preferred color scheme. r=dao
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 98 Branch
Flags: qe-verify+

This enhancement seems to be implemented on Firefox 98.0b3(20220210185745) as well as Nightly 99.0a1(20220210213101). Toggling between light and dark theme works as expected. Checked on macOS Big Sur 11, Linux(Ubuntu 20.04) and Win10.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
Regressions: 1850297
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: