Menu

#58 New colors into SCREENIO.CPY

GC 3.x
wont-fix
nobody
screen (4)
5 - default
2023-06-02
2022-10-23
No

I seem to have seen that the colors with code 8 to 15 have been implemented.
In this case then some screenio.cpy rows should be updated as follows.
The yellow color no longer has code = 6 but code = 14.

*> Colors
78 COB-COLOR-BLACK         VALUE  0.
78 COB-COLOR-BLUE          VALUE  1.
78 COB-COLOR-GREEN         VALUE  2.
78 COB-COLOR-CYAN          VALUE  3.
78 COB-COLOR-RED           VALUE  4.
78 COB-COLOR-MAGENTA       VALUE  5.
*> 78 COB-COLOR-YELLOW     VALUE  6.
78 COB-COLOR-BROWN         VALUE  6. *> Previous value for YELLOW
78 COB-COLOR-WHITE         VALUE  7.
*> new colors (needs GnuCOBOL 3.2 or higher)
78 COB-COLOR-GREY          VALUE  8.
78 COB-COLOR-LIGHT-BLUE    VALUE  9.
78 COB-COLOR-LIGHT-GREEN   VALUE 10.
78 COB-COLOR-LIGHT-CYAN    VALUE 11.
78 COB-COLOR-LIGHT-RED     VALUE 12.
78 COB-COLOR-LIGHT-MAGENTA VALUE 13.
78 COB-COLOR-YELLOW        VALUE 14.
78 COB-COLOR-LIGHT-WHITE   VALUE 15.

Discussion

  • Simon Sobisch

    Simon Sobisch - 2022-12-03

    Please recheck with current 3.2-dev (or in about an hour the CI build); there were some fixes and make checkmanual also shows all the colors now; please note the the actual results of those extended attributes depend on the underlying curses implementation.

    After checking that please give an update if you think that something like that above should be applied - would also love to get feedback from @chaat on this.

     
  • Simon Sobisch

    Simon Sobisch - 2023-05-03

    YELLOW should still be YELLOW (that is the case now, isn't it?)

    Question: as the "new colors" are actually no colors but 0-7 and the HIGHLIGHT/BLINK attribute (depending on use in FOREGROUNd/BACKGROUND) set internally - is it still reasonable to define those as separate colors in a non-standard way?

     
    • Eugenio Di Lorenzo

      Absolutely yes.
      Now that we understand where the problem was, we can consider the updates to the compiler approved and tested.
      Color codes from 8 to 15 are working fine.
      I also confirm that now we can say that YELLOW has code 14 and that code 6 is BROWN.
      see also the attached image from the microfocus COBOL documentation where 14 = YELLOW.
      Below, is new source that can be used to update SCREENIO.CPY with a small udate: LIGHT-MAGENTA is also called "PINK" (same color code = 13). You can use LIGHT-MAGENTA or PINK that is more clear.

      *> Colors
      78 COB-COLOR-BLACK         VALUE  0.
      78 COB-COLOR-BLUE          VALUE  1.
      78 COB-COLOR-GREEN         VALUE  2.
      78 COB-COLOR-CYAN          VALUE  3.
      78 COB-COLOR-RED           VALUE  4.
      78 COB-COLOR-MAGENTA       VALUE  5.
      *> 78 COB-COLOR-YELLOW     VALUE  6.
      78 COB-COLOR-BROWN         VALUE  6. *> Previous value for YELLOW
      78 COB-COLOR-WHITE         VALUE  7.
      *> new colors (needs GnuCOBOL 3.2 or higher)
      78 COB-COLOR-GREY          VALUE  8.
      78 COB-COLOR-LIGHT-BLUE    VALUE  9.
      78 COB-COLOR-LIGHT-GREEN   VALUE 10.
      78 COB-COLOR-LIGHT-CYAN    VALUE 11.
      78 COB-COLOR-LIGHT-RED     VALUE 12.
      78 COB-COLOR-LIGHT-MAGENTA VALUE 13.
      78 COB-COLOR-PINK          VALUE 13.
      78 COB-COLOR-YELLOW        VALUE 14.
      78 COB-COLOR-LIGHT-WHITE   VALUE 15.
      
       
      • Simon Sobisch

        Simon Sobisch - 2023-05-31

        Hm, not sure...

        Find the result with ncurses attached (the setting of COB_LEGACY has zero effect here, the lower part is blinking; the only way to get a "real yellow" [with not adjusted term colors] in the background, would be to use the REVERSE attribute).
        For old PDCurses it wouldn't matter if you have COB_LEGACY set.

        Also mind the standard 9.2.7 Color number

        Color is one of the attributes that may be specified for screen items. For a monochrome terminal, the color attributes are mapped onto other attributes by the implementor.
        A color is selected by specifying an integer that represents the color. The colors and their associated color numbers are:

        0 black
        1 blue
        2 green
        3 cyan
        4 red
        5 magenta
        6 brown/yellow
        7 white

        And most important the non-normative note:

        NOTE The colors above are a rough guide; the actual color depends on the terminal capabilities and can be affected by other considerations such as the HIGHLIGHT attribute. For example, the value 6 might appear as brown, but when HIGHLIGHT is also specified it might appear as yellow. The value 0 might appear as black, but when HIGHLIGHT is also specified it might appear as gray.

         

        Last edit: Simon Sobisch 2023-05-31
  • Simon Sobisch

    Simon Sobisch - 2023-05-30
    • labels: --> screen
    • status: open --> wont-fix
     
  • Simon Sobisch

    Simon Sobisch - 2023-05-30

    Closed as the "extended" color numbers just set an attribute and people likely find it strange if "light" background means blinking.

    Still thank you for taking the time to create this Patch - feel free to go on discussing this here.

     
  • Eugenio Di Lorenzo

    Hi Simon, what we need is to have a behavior similar to MICROFOCUS COBOL (see attached screenshot) and also REALIA COBOL or others COBOL compilers.
    Simply the codes from 8 to 15 correspond to new colors.

    Example.
    Now to have the "grey" color as a backgound color I have to write the code 0 (black) and the BLINK option. Which is absurd but this was the behaviour.
    The desiderd behavior would be to use color code 8 as the background and have a gray background.
    This doesn't work now.
    In the past using code 8 we got an error message.
    Now if we use color 8 we get a 0 color with blink not the gray color !

     
    • Simon Sobisch

      Simon Sobisch - 2023-05-30

      Now to have the "grey" color as a backgound color I have to write the code 0 (black) and the BLINK option. Which is absurd but this was the behaviour.

      ...

      Now if we use color 8 we get a 0 color with blink not the gray color !

      I'm even more confused. You just say that everything behaves as it is documented with the other compilers, no?

      Again: there never was a "grey" it always was blinking black (or highlighted black, depending where used).

      Where do I understand something wrong?

      Note: MF fails to compile the source (after bringing it to fixed-form reference-format) as it does not like the variables for the colors "Numeric literal expected".

       

      Last edit: Simon Sobisch 2023-05-30
      • Eugenio Di Lorenzo

        I try to explain with an example.

        A. Let's go back to when GnuCOBOL didn't accept codes 8 to 15.
        before your recent updates.
        When I had the goal: to have a gray background.
        In the source code: I use BACKGROUND-COLOR 0 BLINK
        (if I was using BACKGROUND-COLOR 8 I got an error message).
        Result on screen: a gray background.

        B. Current situation.
        I have the goal: to have a gray background.
        I would like to use in source code: BACKGROUND-COLOR 8 (without BLINK attribute)
        But if I use BACKGROUND-COLOR 8, today the result on the screen: is a black background and a flashing character. This is wrong.
        Using BACKGROUND-COLOR 8 (without BLINK attribute) and compiling with microfocus cobol (and Realia) gives a grey background and a non flashing character. This is correct.

        C. How it should work.
        I have the goal: to have a gray background.
        Use in source code BACKGROUND-COLOR 8
        I would like to get a gray background on the screen as a result and no flashing character.

        This indicated in point C is the behavior of microfocus cobol and other compiler (I have Realia).

        *Note:
        using microfocus cobol if you use BACKGROUND-COLOR 0 BLINK you get a gray background. As happened in case A.

        A further implementation would be the following: when I use BACKGROUND-COLOR 0 BLINK it would be reasonable to have a flashing black character.
        But microfocus cobol doesn't do it and it is explained in the documentation that I attached to my previous post. .*

        Hope this helps.

         
        • Simon Sobisch

          Simon Sobisch - 2023-05-30

          I would like to get a gray background on the screen as a result and no flashing character.

          Ah, now I possibly see - you remind the old "blink is not blink" behavior, which - I think - was only happen on PDCurses.
          This is not directly related to the "extended" colors but to the following change and note in the NEWS file:

          extended screen io with PDCurses (most Win32 builds): blink and bolding are now enabled, when supported

          If the PDCurses version is "too old" then it still won't blink, but you should get the non-blink behavior when using COB_SCREEN_LEGACY=1 (before the very first use of extended screenio, ideally before the program runs).

          Please test that - and keep in mind that "non-blinking blink" is PDCurses specific.

           
          • Eugenio Di Lorenzo

            Sorry Simon, how should I set COB_SCREEN_LEGACY=1.
            Into the GnuCOBOL program source code with SET ENVIRONMENT ... ?
            ... some another way ?

            What would be the documentation of this parameter ?
            I assume it is not yet present in the PG.

            Note: I'm using the latest version of the compiler downloaded from Arnold's site.

             
            • Simon Sobisch

              Simon Sobisch - 2023-05-31

              Sorry, it is COB_LEGACY, as always use one of:
              * runtime configuration file
              * environment variables
              * set via COBOL

               
              • Eugenio Di Lorenzo

                Finally now everything works fine !
                It was necessary to set the parameter COB_LEGACY = 1 at the beginning of the program.
                I attach the modified program which demonstrates the correct functioning of the colors with codes from 8 to 15.
                Already you can see that everything works fine from SCREEN 1.
                Now we can assume approved and tested the changes that allow the use of codes from 8 to 15 for the colors of BACKGROUND and FOREGROUND.
                We can also update the color documentation in the Programmers Guide and also SCREENIO.CPY.
                If you want I can prepare something for this purpose.

                 
                • Simon Sobisch

                  Simon Sobisch - 2023-05-31

                  If you want I can prepare something for this purpose.

                  Sure, just keep in mind that the actual result of these extended color numbers depends on the terminal's capabilities, and the underlying screenio library (and for PDCurses also the setting of COB_LEGACY) . I think screenio.cpy may not be that useful to adjust.
                  The PG may need an update, it definitely needs one for [feature-requests:#436].

                   

                  Related

                  Wish List: #436

                  • Eugenio Di Lorenzo

                    The documentation for color codes from 8 to 15 is into the bug ticket 889.
                    I think it is ready to copy & paste into the PG.

                    For FR 436 I need to know what it is.
                    I can't find any documentation on the web for CONTROL.

                     

Log in to post a comment.