VirtualBox

Ignore:
Timestamp:
Jan 5, 2017 3:00:35 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
112635
Message:

wuihlpgraphsimple.py: Readable text in bar color.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testmanager/webui/wuihlpgraphsimple.py

    r62484 r65132  
    8585                sValue = escapeElem(oRow.asValues[j]);
    8686                sColor = self.kasColors[j % len(self.kasColors)];
     87                sInvColor = 'white';
     88                if sColor[0] == '#' and len(sColor) == 7:
     89                    sInvColor = '#%06x' % (~int(sColor[1:],16) & 0xffffff,);
    8790
    8891                sReport += '        <tr><td>\n' \
     
    9093                           '            <tr>\n';
    9194                if cPct >= 99:
    92                     sReport += '              <td width="%spx" nowrap bgcolor="%s" align="right">%s&nbsp;</td>\n' \
    93                              % (cxBar, sColor, sValue);
     95                    sReport += '              <td width="%spx" nowrap bgcolor="%s" align="right" style="color:%s;">' \
     96                               '%s&nbsp;</td>\n' \
     97                             % (cxBar, sColor, sInvColor, sValue);
    9498                elif cPct < 1:
    9599                    sReport += '              <td width="%spx" nowrap style="color:%s;">%s</td>\n' \
    96100                             % (self.cxMaxBar - cxBar, sColor, sValue);
    97101                elif cPct >= 50:
    98                     sReport += '              <td width="%spx" nowrap bgcolor="%s" align="right">%s&nbsp;</td>\n' \
     102                    sReport += '              <td width="%spx" nowrap bgcolor="%s" align="right" style="color:%s;">' \
     103                               '%s&nbsp;</td>\n' \
    99104                               '              <td width="%spx" nowrap><div>&nbsp;</div></td>\n' \
    100                              % (cxBar, sColor, sValue, self.cxMaxBar - cxBar);
     105                             % (cxBar, sColor, sInvColor, sValue, self.cxMaxBar - cxBar);
    101106                else:
    102107                    sReport += '              <td width="%spx" nowrap bgcolor="%s"></td>\n' \
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette