BackgroundColor limits white drawing color

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #41028 quote
    AVT
    Participant
    Senior

    Graphical instructions together with BackgroundColor have a funny limit: No matter what BG color you set, lines and text on that background are limited to a very bright gray but can not be white. This is what I found: at least two of the color values must be not higher than 235 (then the third color can have 255). Bug?

    Code for Tests:

    BACKGROUNDCOLOR(0,0,0) // color unimportant
    R=235  // 1st 235
    G=235  // 2nd 235
    B=255  // last can have 255
    DrawText("■",barindex,0,Monospaced,Bold,16) coloured(R,G,B)
    Return
    #41048 quote
    Nicolas
    Keymaster
    Master

    That’s not a bug, this is intentional, it is not possible to set a color brighter or darker than the actual background color. It was already the case with the color panel in the indicator setting, setting a dark gray color when you have a very dark background reverse the color to a brighter one. I know this is annoying when you want to plot something almost transparent… already discussed with IT finance team, I just add this query to my own wish list into the dedicated thread: https://www.prorealcode.com/topic/centralization-of-queries-and-suggestions-on-prorealtime/page/8/#post-41047

    AVT and Bel thanked this post
    #41075 quote
    AVT
    Participant
    Senior

    I tried automatic inverting the colors when a user changes the background color. But here I am really lost, how a general formula should look like which works around these limits. Well for now it’s just one line and found a simple solution. (And for transparency we have the Alpha value now, great to use).

    Thanks Nicolas.

    #41081 quote
    Nicolas
    Keymaster
    Master

    Stop me if I’m wrong but the transparency will not help in this case: even if you make a line fully transparent with Alpha value it will not render as invisible?

    #41150 quote
    AVT
    Participant
    Senior

    Yes, you can completely fade out color. Example here:

    Background black, Text color white (well not really completely bright white, but as far as we can go) and then fading out with Alpha. Code:

    BACKGROUNDCOLOR(0,0,0) // color unimportant
    R=235  // 1st 235
    G=235  // 2nd 235
    B=255  // last can have 255
    
    Fade0=255  // bright
    Fade1=128  // bit less
    Fade2=64   // more less
    Fade3=32   // even more less
    Fade4=0    // invisible
    
    DrawText("■",barindex,0.4,Monospaced,Bold,30) coloured(R,G,B,Fade0)
    DrawText("■",barindex,0.2,Monospaced,Bold,30) coloured(R,G,B,Fade1)
    DrawText("■",barindex,0,Monospaced,Bold,30) coloured(R,G,B,Fade2)
    DrawText("■",barindex,-0.2,Monospaced,Bold,30) coloured(R,G,B,Fade3)
    DrawText("■",barindex,-0.4,Monospaced,Bold,30) coloured(R,G,B,Fade4)
    Return
    Nicolas and AlgoAlex thanked this post
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

BackgroundColor limits white drawing color


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
AVT @avt Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by AVT
8 years, 6 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/18/2017
Status: Active
Attachments: 1 files
Logo Logo
Loading...