Menu

#1398 Add SetWhitespaceAlpha

Committed
closed
nobody
4
2021-06-24
2021-03-09
YX Hao
No

As dark theme is more and more popular, SetWhitespaceAlpha will make it easier to config 1 color with alpha that suites both light and dark colors.

Discussion

<< < 1 2 (Page 2 of 2)
  • YX Hao

    YX Hao - 2021-04-04

    Final effect:
    1. 2 alpha can be set separately: whitespace.fore.alpha=<alpha> and whitespace.fore=#rrggbbaa.
    2. whitespace.fore.alpha controls all colours including that inherited from grammar settings; whitespace.fore controls the colour specified manually.
    3. whitespace.fore.alpha > whitespace.fore, if both exist.

     
  • YX Hao

    YX Hao - 2021-04-06

    OK, to make it simple: no whitespace.fore.alpha, just make whitespace.fore accept also rgba besides rgb.

     
    • YX Hao

      YX Hao - 2021-04-08

      Update scite_5599_Make-whitespace.fore-accept-rgba.patch, as SetWhitespaceFore calling shouldn't be removed currently.

       
      • Neil Hodgson

        Neil Hodgson - 2021-04-15

        It's more that SCI_SETWHITESPACEFORE should forward to vs.elementColours[SC_ELEMENT_WHITE_SPACE] as there should be a single representation of this value. ViewStyle::whitespaceColours gets broken up so that the background can remain a ColourOptional (for now) and all the code that used whitespaceColours.fore moves to elementColours[SC_ELEMENT_WHITE_SPACE]. Something like the attached patch.

        Then SciTE can be updated to only use OptionalSetColour. All the old applications still using SCI_SETWHITESPACEFORE stay the same until SCI_SETWHITESPACEFORE is removed after a period of deprecation.

         
        👍
        2
        • YX Hao

          YX Hao - 2021-04-17

          I thought it would be in 2 commits. Thanks for your detailed description and codes. Here is the updates.

          Known issues with legacy GDI:
          1. SurfaceGDI::LineDraw and SurfaceGDI::PolyLine for DrawTabArrow don't work well with alpha drawing. Maybe also others.
          2. SurfaceGDI::AlphaRectangle is not efficiency enough for "many" tasks.

           
  • Neil Hodgson

    Neil Hodgson - 2021-04-27

    Here's another patch to match the change from ColourOptional to std::optional<ColourAlpha> in [72d5f9] .

    1. SurfaceGDI::LineDraw and SurfaceGDI::PolyLine ... don't work well with alpha drawing

    Yes. Applications can check SCI_SUPPORTSFEATURE(SC_SUPPORTS_TRANSLUCENT_STROKE) and change their drawing settings if they need to. It would be possible to alpha enable tab drawing on GDI for the simplified SCI_SETTABDRAWMODE(SCTD_STRIKEOUT) appearance but that may be more work than its worth.

    2: SurfaceGDI::AlphaRectangle is not efficiency enough for "many" tasks.

    Its slower but its not unusably slow for common cases. Each Scintilla feature has different costs in different scenarios and its up to applications and users to decide where to trade off between features and speed. Its reasonable to turn off higher cost features on slower machine or for huge documents.

     

    Related

    Commit: [72d5f9]

    • YX Hao

      YX Hao - 2021-04-27

      Isn't atomic commits preferred?
      This is beyond my knowledge for so many changes, especially during this big-change stage.
      If there is any contribute from me, it's just the idea. Others are all your efforts. Please commit it at the proper time by your schedule.

      Many thanks!

       
      • Neil Hodgson

        Neil Hodgson - 2021-04-28

        Isn't atomic commits preferred?

        I have more of a preference for atomic commits than most and will often write a preparatory revision that restructures the code with no change in behaviour before a functional change but this patch seems pretty atomic to me. There are two elements being modified, the foreground and background and they could be treated separately but they are initially in a single whitespaceColours field so I think that including both in a change set is better.

        There could be two change sets: splitting the variable into ViewStyle::whitespaceFore and ViewStyle::whitespaceBack then another change set moving whitespaceFore to vs.elementColours[SC_ELEMENT_WHITE_SPACE] but that introduces an extra field that is only there for a single revision.

         
  • Neil Hodgson

    Neil Hodgson - 2021-05-15
    • labels: scintilla, appearance --> scintilla, appearance, whitespace
    • Group: Won't_Implement --> Committed
     
  • Neil Hodgson

    Neil Hodgson - 2021-05-15

    SC_ELEMENT_WHITE_SPACE allowing a translucent value was committed as [572e28] .

     

    Related

    Commit: [572e28]

  • Zufu Liu

    Zufu Liu - 2021-05-25

    As a side effect of this change, the appearance for wrap symbol may not be the desired when white space alpha is used. A quick for wrap symbol color is change ViewStyle::WrapColour() to returns Opaque(), but it seems better to define a new element color for wrap symbol.

     
    • Neil Hodgson

      Neil Hodgson - 2021-06-24

      Wrap symbol colour has been tied to whitespace colour for years and its not unreasonable to include alpha in that.

      A more specific setting for the wrap markers may be reasonable but that is a separate issue.

       
  • Neil Hodgson

    Neil Hodgson - 2021-06-24
    • status: open --> closed
     
<< < 1 2 (Page 2 of 2)

Log in to post a comment.