Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » U++ community news and announcements » DarkTheme function parameters changed
Re: DarkTheme function parameters changed [message #60917 is a reply to message #60916] Mon, 07 October 2024 16:49 Go to previous messageGo to previous message
Lance is currently offline  Lance
Messages: 656
Registered: March 2007
Contributor
I see the challenge now.

We need something like theme-dependent color.

With regard to Blend(), would it ever need more than 2 colors?

I have a hackish solution.

class DynColor{
   struct _combo{
       Color c;
       char  f[4];
   };

   operator Color()const{
      switch(f[3] & 3){
      case 0: // the 64 bits are a Color*
          return * reinterpret_cast<const Color*>(this);
      case 1: // a normal color hold at data.c
          return c;
      case 2: // Blend, with f[0], f[1] the index
              // of System colors, hopefully
              // we don't have more than 256 of them
              // , and f[2] hold the third paramenter of Blend
         return Blend(GetSysColorFromIndex(f[0],
                  GetSysColorFromIndex(f[1]),
                  f[2]);
       case 3: // let's handle the
//ctrl.Add(AttrText("Hello there!").Ink(IsDarkTheme() ? Blend(White(), LtBlue()) : Blue());  
               // case here
            // theme dependant blend
           return IsDarkTheme() ?
                Blend( treat_c as byte[4], and store blend information there) :
                Blend(GetSysColorFromIndex(f[0],
                  GetSysColorFromIndex(f[1]),
                  f[2]);
          
      }
   }

private:
   combo data;
};


Just a prototype for conception. We need to consider endianness at least.

Now, we can
ctrl.Add(AttrText("Hello there!").Ink(ConstructDynColor(DarkBlender{...}, NormalBlender{...}));

Yes I am aware this requires changes to AttrText code. I can imagine it's quite involving.

Also this will require everywhere that requires dynamic color to use 64-bit color, a double in storage space.

[Updated on: Mon, 07 October 2024 17:31]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: SetRect "MegaRect" support...
Next Topic: 2024rc
Goto Forum:
  


Current Time: Mon Jun 09 17:10:15 CEST 2025

Total time taken to generate the page: 0.04288 seconds