Skip to content

Add showTechnicalFormattingAtReview global command, with RGB color info (#8674)#12372

Closed
JulienCochuyt wants to merge 1 commit into
nvaccess:masterfrom
accessolutions:i8674-rgbColors
Closed

Add showTechnicalFormattingAtReview global command, with RGB color info (#8674)#12372
JulienCochuyt wants to merge 1 commit into
nvaccess:masterfrom
accessolutions:i8674-rgbColors

Conversation

@JulienCochuyt

@JulienCochuyt JulienCochuyt commented May 6, 2021

Copy link
Copy Markdown
Contributor

Link to issue number:

Fixes #8674

Summary of the issue:

Developers and content authors often need to know the exact color of the text they review in more precise terms than the human-readable form commonly served to end users.

Description of how this pull request fixes the issue:

Add a showTechnicalFormattingAtReview global command to provide this information along with the rest of the formatting in a browsable message.

Testing strategy:

Ran and manually tested from a source copy.

Known issues with pull request:

Change log entries:

New features
More technical information regarding the formatting of the text at the review position can now be obtained by pressing NVDA+alt+shift+f. For now, it differs from the usual formatting information by providing the exact RGB values for foreground and background colors.

Code Review Checklist:

  • Pull Request description is up to date.
  • Unit tests.
  • System (end to end) tests.
  • Manual tests.
  • User Documentation.
  • Change log entry.
  • Context sensitive help for GUI changes.

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit b0f6fb276b

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 5f2ca71d0d

@JulienCochuyt

Copy link
Copy Markdown
Contributor Author

If I read correctly, test_boundingRectFromOffsetAtBottom seems to fail in AppVeyor but passes locally.
@feerrenrut, any idea?

@LeonarddeR

Copy link
Copy Markdown
Collaborator

We have failures in a bunch of system tests, it seems.

@LeonarddeR LeonarddeR left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Awesome!

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 5f2ca71d0d

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 4f76b663ad

@JulienCochuyt JulienCochuyt marked this pull request as ready for review May 7, 2021 11:48
@JulienCochuyt JulienCochuyt requested a review from a team as a code owner May 7, 2021 11:48
@JulienCochuyt JulienCochuyt requested a review from seanbudd May 7, 2021 11:48
…info (nvaccess#8674)

Co-authored by: Leonard de Ruijter <leonardder@users.noreply.github.com>
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 5aa188ba18

@michaelDCurran michaelDCurran left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would much prefer to see the color info be simply included in the NVDA+f1 dev info. Note that the NVDA+f1 dev info script already acts upon the navigator object, so extending it to alsoinclude some info about the current review position seems logical enough.
This then avoids adding an extra script for just one bit of extra info, and avoids extra logic in speech.
Another alternative could be to have an Advanced setting that allows the user to configure if NvDA exposes raw color info when available where ever it speaks or displays color names. Format changes, and formatting info script as examples.
I think I still prefer my first suggestion though.

@feerrenrut

Copy link
Copy Markdown
Contributor

@michaelDCurran I think the dev info is for a different type of user. I'd differentiate between NVDA developers, for whom reading the log / devInfo output is fine, and general developers who happen to use NVDA. This second group want access to more technical information, but not to have to sift through all of the noise of NVDA specific information.

I think this more appropriate as a command. I struggle to believe anyone would want to always have the color value reported, but there are occasions for developers where you want only the color value reported.

I haven't looked at the implementation yet, and perhaps it is too complicated and just belongs in and addon.

Comment thread source/speech/__init__.py
Comment on lines +1969 to +1971
f"{color.name}"
f" (RGB: {color.red}, {color.green}, {color.blue}"
f" / #{color.red:02x}{color.green:02x}{color.blue:02x})"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

UX feedback: I hadn't thought about cases like _("{color1} to {color2}") which using this as the replacement will be very long. Perhaps it is best to have a single color format reported. Developers should be able to convert themselves. I'd personally choose Hex, since it is shorter.

From a code design, I really don't like the idea of introducing another parameter. This should be two functions sharing a common interface. Then use something like the strategy pattern with those two implementations. Ideally, nothing in getFormatFieldSpeech needs to know, in reality we might need to make a change to getFormatFieldSpeech to enable a mechanism like this. The upside is, if we do it right we can start to split up getFormatFieldSpeech into a series of formatters.

@seanbudd

seanbudd commented Jun 7, 2021

Copy link
Copy Markdown
Member

@feerrenrut, @michaelDCurran thoughts on adding a new settings panel in document formatting for this?

I propose something like Document Formatting > Technical > Colour formatting with a CustomCheckListBox for colours so you can pick which formatting(s) to report, with the default just being the human readable name.

Then, add a __str__ or __repr__ function to colors.RGB which determines the formatting using that setting and similar logic to _getColorName. Then we can just use colors.RGB instances directly in reporting.

We can just use the new function in the custom command to begin with, as the rest of the code is dependent on color.name.

@feerrenrut

Copy link
Copy Markdown
Contributor

@seanbudd I haven't considered the implications of the technical details you suggested, but I think this will have to go down the UI path you recommend, i.e.

I propose something like Document Formatting > Technical > Colour formatting with a CustomCheckListBox for colours so you can pick which formatting(s) to report, with the default just being the human readable name.

Swapping to a preferred technical color description will work for any of the in-line color reporting EG:

I still think there a place for a command (such as script_showTechnicalFormattingAtReview) to present a browsable message containing multiple formats for foreground and background color.

@CyrilleB79

Copy link
Copy Markdown
Contributor

I am a bit concerned with adding a technical option in the formatting settings panel which has already a lot of options; this is also in contradiction with the reason why #8674 was re-opened and with #8674 (comment).

There are two requirements that are both legitimate and that are not totally compatible here:

  • Keep the UI free from technical options to avoid to have too complex options for non-developer users. E.g. a simple unassigned technical command is OK
  • The need for developers to be able to customize the way the information is reported

My initial preference was to have this eature in an add-on but this was already discussed in #8674 and it is not the direction we are taking now.
So if we agree to have this feature in the core, I would prefer the customization option to be in the advanced panel. Or in another new panel that would gather technical options, i.e. the advanced panel would be dedicated to new NVDA features whereas the new technical panel would be more towards advanced needs but not for NVDA debugging / testing.

@feerrenrut

Copy link
Copy Markdown
Contributor

I'm ok with this starting as an advanced option. Users of the advanced settings panel should be more aware of options migrating later on, this makes it easier for us to consolidate the color options later. Thinking about the document formatting panel in settings, these are probably more specific than configuration we are talking about. I think the intention is:

  • Document formatting: in the context of a document, should color be reported at all.
  • New Color presentation option: How should the a color (in any context) be reported.

@seanbudd seanbudd added the blocked/merge-conflicts Merge conflicts exist on this PR label Sep 22, 2021
@lukaszgo1

Copy link
Copy Markdown
Contributor

A few general thoughts:

  • Having a configuration panel for this is IMO an overkill.
  • Do we really need to be able to customize how colors are reported when reading - i.e. isn't it sufficient to be able to see RGB (or whatever notation we chose in the end) in the browseable message?
  • Assuming that we don't need to modify the way in which colors are reported my personal preference would be not to introduce another command for this but just add RGB values to the end of formatting message when pressing NVDA+f twice. Aside from reducing complexity this is the way in which all other AT's for Windows report RGB values for a color - while I am not advocating to blindly copy others since the system is familiar for users and works I see no reason not to implement the same solution.

@lukaszgo1

Copy link
Copy Markdown
Contributor

It looks like this is stalled due to the fact that we cannot agree on a satisfying implementation. Would it be possible to someone from NV Access to take a look at the discussion including my proposal from the last comment and share their thoughts so that this work can be progressed?

@michaelDCurran

Copy link
Copy Markdown
Member

I tend to agree with @lukaszgo1 . We really don't need to over engineer this. We can just include the raw rgb after color names in the Show Formatting browsable message with NvDA+f twice. globalCommand's _reportFormattingHelper should be able to look for colors.RGB objects in the fetched format and change them into strings of "{name}, RGB({red}, {green}, {blue})" itself, if the formatting is being shown as a browseable message.

@seanbudd seanbudd marked this pull request as draft February 18, 2022 05:41
@seanbudd

Copy link
Copy Markdown
Member

This is marked as a draft, this should be followed up with @michaelDCurran design

@Adriani90

Copy link
Copy Markdown
Collaborator

cc: @ABuffEr maybe you are interested in this work as well, not sure if @JulienCochuyt is still very active these days.

@seanbudd

Copy link
Copy Markdown
Member

Closing as abandoned

@seanbudd seanbudd closed this Jun 17, 2024
@seanbudd seanbudd added the Abandoned requested reports or updates are missing since more than 1 year, author or users are not available. label Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Abandoned requested reports or updates are missing since more than 1 year, author or users are not available. blocked/merge-conflicts Merge conflicts exist on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add RGB values for colors to formatting reporting

9 participants