1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QColor Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QColor Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QColor class provides colors based on RGB, HSV or CMYK
values. <a href="#details">More...</a></p>
<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qcolor.html#Spec-enum">Spec</a></b> { Invalid, Rgb, Hsv, Cmyk, Hsl }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qcolor.html#QColor">__init__</a></b> (<i>self</i>, Qt.GlobalColor <i>color</i>)</li><li><div class="fn" /><b><a href="qcolor.html#QColor-2">__init__</a></b> (<i>self</i>, int <i>rgb</i>)</li><li><div class="fn" /><b><a href="qcolor.html#QColor-3">__init__</a></b> (<i>self</i>, QVariant <i>variant</i>)</li><li><div class="fn" /><b><a href="qcolor.html#QColor-4">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qcolor.html#QColor-5">__init__</a></b> (<i>self</i>, int <i>r</i>, int <i>g</i>, int <i>b</i>, int <i>alpha</i> = 255)</li><li><div class="fn" /><b><a href="qcolor.html#QColor-6">__init__</a></b> (<i>self</i>, QString <i>aname</i>)</li><li><div class="fn" /><b><a href="qcolor.html#QColor-7">__init__</a></b> (<i>self</i>, QColor <i>acolor</i>)</li><li><div class="fn" />int <b><a href="qcolor.html#alpha">alpha</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qcolor.html#alphaF">alphaF</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qcolor.html#black">black</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qcolor.html#blackF">blackF</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qcolor.html#blue">blue</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qcolor.html#blueF">blueF</a></b> (<i>self</i>)</li><li><div class="fn" />QColor <b><a href="qcolor.html#convertTo">convertTo</a></b> (<i>self</i>, Spec <i>colorSpec</i>)</li><li><div class="fn" />int <b><a href="qcolor.html#cyan">cyan</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qcolor.html#cyanF">cyanF</a></b> (<i>self</i>)</li><li><div class="fn" />QColor <b><a href="qcolor.html#dark">dark</a></b> (<i>self</i>, int <i>factor</i> = 200)</li><li><div class="fn" />QColor <b><a href="qcolor.html#darker">darker</a></b> (<i>self</i>, int <i>factor</i> = 200)</li><li><div class="fn" />(int <i>c</i>, int <i>m</i>, int <i>y</i>, int <i>k</i>, int <i>alpha</i>) <b><a href="qcolor.html#getCmyk">getCmyk</a></b> (<i>self</i>)</li><li><div class="fn" />(float <i>c</i>, float <i>m</i>, float <i>y</i>, float <i>k</i>, float <i>alpha</i>) <b><a href="qcolor.html#getCmykF">getCmykF</a></b> (<i>self</i>)</li><li><div class="fn" />(int <i>h</i>, int <i>s</i>, int <i>l</i>, int <i>alpha</i>) <b><a href="qcolor.html#getHsl">getHsl</a></b> (<i>self</i>)</li><li><div class="fn" />(float <i>h</i>, float <i>s</i>, float <i>l</i>, float <i>alpha</i>) <b><a href="qcolor.html#getHslF">getHslF</a></b> (<i>self</i>)</li><li><div class="fn" />(int <i>h</i>, int <i>s</i>, int <i>v</i>, int <i>alpha</i>) <b><a href="qcolor.html#getHsv">getHsv</a></b> (<i>self</i>)</li><li><div class="fn" />(float <i>h</i>, float <i>s</i>, float <i>v</i>, float <i>alpha</i>) <b><a href="qcolor.html#getHsvF">getHsvF</a></b> (<i>self</i>)</li><li><div class="fn" />(int <i>r</i>, int <i>g</i>, int <i>b</i>, int <i>alpha</i>) <b><a href="qcolor.html#getRgb">getRgb</a></b> (<i>self</i>)</li><li><div class="fn" />(float <i>r</i>, float <i>g</i>, float <i>b</i>, float <i>alpha</i>) <b><a href="qcolor.html#getRgbF">getRgbF</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qcolor.html#green">green</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qcolor.html#greenF">greenF</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qcolor.html#hslHue">hslHue</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qcolor.html#hslHueF">hslHueF</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qcolor.html#hslSaturation">hslSaturation</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qcolor.html#hslSaturationF">hslSaturationF</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qcolor.html#hsvHue">hsvHue</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qcolor.html#hsvHueF">hsvHueF</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qcolor.html#hsvSaturation">hsvSaturation</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qcolor.html#hsvSaturationF">hsvSaturationF</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qcolor.html#hue">hue</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qcolor.html#hueF">hueF</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qcolor.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />QColor <b><a href="qcolor.html#light">light</a></b> (<i>self</i>, int <i>factor</i> = 150)</li><li><div class="fn" />QColor <b><a href="qcolor.html#lighter">lighter</a></b> (<i>self</i>, int <i>factor</i> = 150)</li><li><div class="fn" />int <b><a href="qcolor.html#lightness">lightness</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qcolor.html#lightnessF">lightnessF</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qcolor.html#magenta">magenta</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qcolor.html#magentaF">magentaF</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qcolor.html#name">name</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qcolor.html#red">red</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qcolor.html#redF">redF</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qcolor.html#rgb">rgb</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qcolor.html#rgba">rgba</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qcolor.html#saturation">saturation</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qcolor.html#saturationF">saturationF</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qcolor.html#setAlpha">setAlpha</a></b> (<i>self</i>, int <i>alpha</i>)</li><li><div class="fn" /><b><a href="qcolor.html#setAlphaF">setAlphaF</a></b> (<i>self</i>, float <i>alpha</i>)</li><li><div class="fn" /><b><a href="qcolor.html#setBlue">setBlue</a></b> (<i>self</i>, int <i>blue</i>)</li><li><div class="fn" /><b><a href="qcolor.html#setBlueF">setBlueF</a></b> (<i>self</i>, float <i>blue</i>)</li><li><div class="fn" /><b><a href="qcolor.html#setCmyk">setCmyk</a></b> (<i>self</i>, int <i>c</i>, int <i>m</i>, int <i>y</i>, int <i>k</i>, int <i>alpha</i> = 255)</li><li><div class="fn" /><b><a href="qcolor.html#setCmykF">setCmykF</a></b> (<i>self</i>, float <i>c</i>, float <i>m</i>, float <i>y</i>, float <i>k</i>, float <i>alpha</i> = 1)</li><li><div class="fn" /><b><a href="qcolor.html#setGreen">setGreen</a></b> (<i>self</i>, int <i>green</i>)</li><li><div class="fn" /><b><a href="qcolor.html#setGreenF">setGreenF</a></b> (<i>self</i>, float <i>green</i>)</li><li><div class="fn" /><b><a href="qcolor.html#setHsl">setHsl</a></b> (<i>self</i>, int <i>h</i>, int <i>s</i>, int <i>l</i>, int <i>alpha</i> = 255)</li><li><div class="fn" /><b><a href="qcolor.html#setHslF">setHslF</a></b> (<i>self</i>, float <i>h</i>, float <i>s</i>, float <i>l</i>, float <i>alpha</i> = 1)</li><li><div class="fn" /><b><a href="qcolor.html#setHsv">setHsv</a></b> (<i>self</i>, int <i>h</i>, int <i>s</i>, int <i>v</i>, int <i>alpha</i> = 255)</li><li><div class="fn" /><b><a href="qcolor.html#setHsvF">setHsvF</a></b> (<i>self</i>, float <i>h</i>, float <i>s</i>, float <i>v</i>, float <i>alpha</i> = 1)</li><li><div class="fn" /><b><a href="qcolor.html#setNamedColor">setNamedColor</a></b> (<i>self</i>, QString <i>name</i>)</li><li><div class="fn" /><b><a href="qcolor.html#setRed">setRed</a></b> (<i>self</i>, int <i>red</i>)</li><li><div class="fn" /><b><a href="qcolor.html#setRedF">setRedF</a></b> (<i>self</i>, float <i>red</i>)</li><li><div class="fn" /><b><a href="qcolor.html#setRgb">setRgb</a></b> (<i>self</i>, int <i>r</i>, int <i>g</i>, int <i>b</i>, int <i>alpha</i> = 255)</li><li><div class="fn" /><b><a href="qcolor.html#setRgb-2">setRgb</a></b> (<i>self</i>, int <i>rgb</i>)</li><li><div class="fn" /><b><a href="qcolor.html#setRgba">setRgba</a></b> (<i>self</i>, int <i>rgba</i>)</li><li><div class="fn" /><b><a href="qcolor.html#setRgbF">setRgbF</a></b> (<i>self</i>, float <i>r</i>, float <i>g</i>, float <i>b</i>, float <i>alpha</i> = 1)</li><li><div class="fn" />Spec <b><a href="qcolor.html#spec">spec</a></b> (<i>self</i>)</li><li><div class="fn" />QColor <b><a href="qcolor.html#toCmyk">toCmyk</a></b> (<i>self</i>)</li><li><div class="fn" />QColor <b><a href="qcolor.html#toHsl">toHsl</a></b> (<i>self</i>)</li><li><div class="fn" />QColor <b><a href="qcolor.html#toHsv">toHsv</a></b> (<i>self</i>)</li><li><div class="fn" />QColor <b><a href="qcolor.html#toRgb">toRgb</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qcolor.html#value">value</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qcolor.html#valueF">valueF</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qcolor.html#yellow">yellow</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qcolor.html#yellowF">yellowF</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />bool <b><a href="qcolor.html#allowX11ColorNames">allowX11ColorNames</a></b> ()</li><li><div class="fn" />QStringList <b><a href="qcolor.html#colorNames">colorNames</a></b> ()</li><li><div class="fn" />QColor <b><a href="qcolor.html#fromCmyk">fromCmyk</a></b> (int <i>c</i>, int <i>m</i>, int <i>y</i>, int <i>k</i>, int <i>alpha</i> = 255)</li><li><div class="fn" />QColor <b><a href="qcolor.html#fromCmykF">fromCmykF</a></b> (float <i>c</i>, float <i>m</i>, float <i>y</i>, float <i>k</i>, float <i>alpha</i> = 1)</li><li><div class="fn" />QColor <b><a href="qcolor.html#fromHsl">fromHsl</a></b> (int <i>h</i>, int <i>s</i>, int <i>l</i>, int <i>alpha</i> = 255)</li><li><div class="fn" />QColor <b><a href="qcolor.html#fromHslF">fromHslF</a></b> (float <i>h</i>, float <i>s</i>, float <i>l</i>, float <i>alpha</i> = 1)</li><li><div class="fn" />QColor <b><a href="qcolor.html#fromHsv">fromHsv</a></b> (int <i>h</i>, int <i>s</i>, int <i>v</i>, int <i>alpha</i> = 255)</li><li><div class="fn" />QColor <b><a href="qcolor.html#fromHsvF">fromHsvF</a></b> (float <i>h</i>, float <i>s</i>, float <i>v</i>, float <i>alpha</i> = 1)</li><li><div class="fn" />QColor <b><a href="qcolor.html#fromRgb">fromRgb</a></b> (int <i>rgb</i>)</li><li><div class="fn" />QColor <b><a href="qcolor.html#fromRgb-2">fromRgb</a></b> (int <i>r</i>, int <i>g</i>, int <i>b</i>, int <i>alpha</i> = 255)</li><li><div class="fn" />QColor <b><a href="qcolor.html#fromRgba">fromRgba</a></b> (int <i>rgba</i>)</li><li><div class="fn" />QColor <b><a href="qcolor.html#fromRgbF">fromRgbF</a></b> (float <i>r</i>, float <i>g</i>, float <i>b</i>, float <i>alpha</i> = 1)</li><li><div class="fn" />bool <b><a href="qcolor.html#isValidColor">isValidColor</a></b> (QString <i>name</i>)</li><li><div class="fn" /><b><a href="qcolor.html#setAllowX11ColorNames">setAllowX11ColorNames</a></b> (bool <i>enabled</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qcolor.html#__eq__">__eq__</a></b> (<i>self</i>, QColor <i>c</i>)</li><li><div class="fn" />bool <b><a href="qcolor.html#__ne__">__ne__</a></b> (<i>self</i>, QColor <i>c</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>This class can be pickled.</p><p>A
<a href="qt.html#GlobalColor-enum">Qt.GlobalColor</a>
may be used whenever a
<a href="qcolor.html">QColor</a>
is expected.</p>
<p>The QColor class provides colors based on RGB, HSV or CMYK
values.</p>
<p>A color is normally specified in terms of RGB (red, green, and
blue) components, but it is also possible to specify it in terms of
HSV (hue, saturation, and value) and CMYK (cyan, magenta, yellow
and black) components. In addition a color can be specified using a
color name. The color name can be any of the SVG 1.0 color
names.</p>
<table class="generic">
<thead>
<tr class="qt-style">
<th>RGB</th>
<th>HSV</th>
<th>CMYK</th>
</tr>
</thead>
<tr class="odd" valign="top">
<td><img alt="" src="images/qcolor-rgb.png" /></td>
<td><img alt="" src="images/qcolor-hsv.png" /></td>
<td><img alt="" src="images/qcolor-cmyk.png" /></td>
</tr>
</table>
<p>The QColor constructor creates the color based on RGB values. To
create a QColor based on either HSV or CMYK values, use the
<a href="qcolor.html#toHsv">toHsv</a>() and <a href="qcolor.html#toCmyk">toCmyk</a>() functions respectively. These
functions return a copy of the color using the desired format. In
addition the static <a href="qcolor.html#fromRgb">fromRgb</a>(),
<a href="qcolor.html#fromHsv">fromHsv</a>() and <a href="qcolor.html#fromCmyk">fromCmyk</a>() functions create colors from
the specified values. Alternatively, a color can be converted to
any of the three formats using the <a href="qcolor.html#convertTo">convertTo</a>() function (returning a copy
of the color in the desired format), or any of the <a href="qcolor.html#setRgb">setRgb</a>(), <a href="qcolor.html#setHsv">setHsv</a>() and <a href="qcolor.html#setCmyk">setCmyk</a>() functions altering <i>this</i>
color's format. The <a href="qcolor.html#spec">spec</a>() function
tells how the color was specified.</p>
<p>A color can be set by passing an RGB string (such as "#112233"),
or a color name (such as "blue"), to the <a href="qcolor.html#setNamedColor">setNamedColor</a>() function. The color
names are taken from the SVG 1.0 color names. The <a href="qcolor.html#name">name</a>() function returns the name of the
color in the format "#RRGGBB". Colors can also be set using
<a href="qcolor.html#setRgb">setRgb</a>(), <a href="qcolor.html#setHsv">setHsv</a>() and <a href="qcolor.html#setCmyk">setCmyk</a>(). To get a lighter or darker
color use the <a href="qcolor.html#lighter">lighter</a>() and
<a href="qcolor.html#darker">darker</a>() functions
respectively.</p>
<p>The <a href="qcolor.html#isValid">isValid</a>() function
indicates whether a QColor is legal at all. For example, a RGB
color with RGB values out of range is illegal. For performance
reasons, QColor mostly disregards illegal colors, and for that
reason, the result of using an invalid color is undefined.</p>
<p>The color components can be retrieved individually, e.g with
<a href="qcolor.html#red">red</a>(), <a href="qcolor.html#hue">hue</a>() and <a href="qcolor.html#cyan">cyan</a>(). The values of the color components
can also be retrieved in one go using the <a href="qcolor.html#getRgb">getRgb</a>(), <a href="qcolor.html#getHsv">getHsv</a>() and <a href="qcolor.html#getCmyk">getCmyk</a>() functions. Using the RGB color
model, the color components can in addition be accessed with
<a href="qcolor.html#rgb">rgb</a>().</p>
<p>There are several related non-members: <a href="qcolor.html#QRgb-typedef">QRgb</a> is a typdef for an unsigned int
representing the RGB value triplet (r, g, b). Note that it also can
hold a value for the alpha-channel (for more information, see the
<a href="#alpha-blended-drawing">Alpha-Blended Drawing</a>
section). The <a href="qtgui.html#qRed">qRed</a>(), <a href="qtgui.html#qBlue">qBlue</a>() and <a href="qtgui.html#qGreen">qGreen</a>() functions return the respective
component of the given <a href="qcolor.html#QRgb-typedef">QRgb</a>
value, while the <a href="qtgui.html#qRgb">qRgb</a>() and <a href="qtgui.html#qRgba">qRgba</a>() functions create and return the
<a href="qcolor.html#QRgb-typedef">QRgb</a> triplet based on the
given component values. Finally, the <a href="qtgui.html#qAlpha">qAlpha</a>() function returns the alpha
component of the provided <a href="qcolor.html#QRgb-typedef">QRgb</a>, and the <a href="qtgui.html#qGray">qGray</a>() function calculates and return a
gray value based on the given value.</p>
<p>QColor is platform and device independent. The <a href="qcolormap.html">QColormap</a> class maps the color to the
hardware.</p>
<p>For more information about painting in general, see the <a href="paintsystem.html">Paint System</a> documentation.</p>
<a id="integer-vs-floating-point-precision" name="integer-vs-floating-point-precision" />
<h3>Integer vs. Floating Point Precision</h3>
<p>QColor supports floating point precision and provides floating
point versions of all the color components functions, e.g. <a href="qcolor.html#getRgbF">getRgbF</a>(), <a href="qcolor.html#hueF">hueF</a>() and <a href="qcolor.html#fromCmykF">fromCmykF</a>(). Note that since the
components are stored using 16-bit integers, there might be minor
deviations between the values set using, for example, <a href="qcolor.html#setRgbF">setRgbF</a>() and the values returned by the
<a href="qcolor.html#getRgbF">getRgbF</a>() function due to
rounding.</p>
<p>While the integer based functions take values in the range 0-255
(except <a href="qcolor.html#hue">hue</a>() which must have values
within the range 0-359), the floating point functions accept values
in the range 0.0 - 1.0.</p>
<a id="alpha-blended-drawing" name="alpha-blended-drawing" />
<h3>Alpha-Blended Drawing</h3>
<p>QColor also support alpha-blended outlining and filling. The
alpha channel of a color specifies the transparency effect, 0
represents a fully transparent color, while 255 represents a fully
opaque color. For example:</p>
<pre class="cpp">
<span class="comment">// Specify semi-transparent red</span>
painter<span class="operator">.</span>setBrush(<span class="type">QColor</span>(<span class="number">255</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">127</span>));
painter<span class="operator">.</span>drawRect(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> width()<span class="operator">/</span><span class="number">2</span><span class="operator">,</span> height());
<span class="comment">// Specify semi-transparent blue</span>
painter<span class="operator">.</span>setBrush(<span class="type">QColor</span>(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">255</span><span class="operator">,</span> <span class="number">127</span>));
painter<span class="operator">.</span>drawRect(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> width()<span class="operator">,</span> height()<span class="operator">/</span><span class="number">2</span>);
</pre>
<p>The code above produces the following output:</p>
<p class="centerAlign"><img alt="" src="images/alphafill.png" /></p>
<p>Alpha-blended drawing is supported on Windows, Mac OS X, and on
X11 systems that have the X Render extension installed.</p>
<p>The alpha channel of a color can be retrieved and set using the
<a href="qcolor.html#alpha">alpha</a>() and <a href="qcolor.html#setAlpha">setAlpha</a>() functions if its value is an
integer, and <a href="qcolor.html#alphaF">alphaF</a>() and <a href="qcolor.html#setAlphaF">setAlphaF</a>() if its value is qreal
(double). By default, the alpha-channel is set to 255 (opaque). To
retrieve and set <i>all</i> the RGB color components (including the
alpha-channel) in one go, use the <a href="qcolor.html#rgba">rgba</a>() and <a href="qcolor.html#setRgba">setRgba</a>() functions.</p>
<a id="predefined-colors" name="predefined-colors" />
<h3>Predefined Colors</h3>
<p>There are 20 predefined QColors described by the <a href="qt.html#GlobalColor-enum">Qt.GlobalColor</a> enum, including
black, white, primary and secondary colors, darker versions of
these colors and three shades of gray. QColor also recognizes a
variety of color names; the static <a href="qcolor.html#colorNames">colorNames</a>() function returns a
<a href="qstringlist.html">QStringList</a> color names that QColor
knows about.</p>
<p class="centerAlign"><img alt="Qt Colors" src="images/qt-colors.png" /></p>
<p>Additionally, the <a href="qt.html#GlobalColor-enum">Qt.color0</a>, <a href="qt.html#GlobalColor-enum">Qt.color1</a> and <a href="qt.html#GlobalColor-enum">Qt.transparent</a> colors are used for
special purposes.</p>
<p><a href="qt.html#GlobalColor-enum">Qt.color0</a> (zero pixel
value) and <a href="qt.html#GlobalColor-enum">Qt.color1</a>
(non-zero pixel value) are special colors for drawing in QBitmaps.
Painting with <a href="qt.html#GlobalColor-enum">Qt.color0</a>
sets the bitmap bits to 0 (transparent; i.e., background), and
painting with <a href="qt.html#GlobalColor-enum">Qt.color1</a>
sets the bits to 1 (opaque; i.e., foreground).</p>
<p><a href="qt.html#GlobalColor-enum">Qt.transparent</a> is used
to indicate a transparent pixel. When painting with this value, a
pixel value will be used that is appropriate for the underlying
pixel format in use.</p>
<a id="the-hsv-color-model" name="the-hsv-color-model" />
<h3>The HSV Color Model</h3>
<p>The RGB model is hardware-oriented. Its representation is close
to what most monitors show. In contrast, HSV represents color in a
way more suited to the human perception of color. For example, the
relationships "stronger than", "darker than", and "the opposite of"
are easily expressed in HSV but are much harder to express in
RGB.</p>
<p>HSV, like RGB, has three components:</p>
<ul>
<li>H, for hue, is in the range 0 to 359 if the color is chromatic
(not gray), or meaningless if it is gray. It represents degrees on
the color wheel familiar to most people. Red is 0 (degrees), green
is 120, and blue is 240.
<p><img alt="" src="images/qcolor-hue.png" /></p>
</li>
<li>S, for saturation, is in the range 0 to 255, and the bigger it
is, the stronger the color is. Grayish colors have saturation near
0; very strong colors have saturation near 255.
<p><img alt="" src="images/qcolor-saturation.png" /></p>
</li>
<li>V, for value, is in the range 0 to 255 and represents lightness
or brightness of the color. 0 is black; 255 is as far from black as
possible.
<p><img alt="" src="images/qcolor-value.png" /></p>
</li>
</ul>
<p>Here are some examples: pure red is H=0, S=255, V=255; a dark
red, moving slightly towards the magenta, could be H=350
(equivalent to -10), S=255, V=180; a grayish light red could have H
about 0 (say 350-359 or 0-10), S about 50-100, and S=255.</p>
<p>Qt returns a hue value of -1 for achromatic colors. If you pass
a hue value that is too large, Qt forces it into range. Hue 360 or
720 is treated as 0; hue 540 is treated as 180.</p>
<p>In addition to the standard HSV model, Qt provides an
alpha-channel to feature <a href="#alpha-blended-drawing">alpha-blended drawing</a>.</p>
<a id="the-hsl-color-model" name="the-hsl-color-model" />
<h3>The HSL Color Model</h3>
<p>HSL is similar to HSV. Instead of value parameter from HSV, HSL
has the lightness parameter. The lightness parameter goes from
black to color and from color to white. If you go outside at the
night its black or dark gray. At day its colorful but if you look
in a really strong light a things they are going to white and wash
out.</p>
<a id="the-cmyk-color-model" name="the-cmyk-color-model" />
<h3>The CMYK Color Model</h3>
<p>While the RGB and HSV color models are used for display on
computer monitors, the CMYK model is used in the four-color
printing process of printing presses and some hard-copy
devices.</p>
<p>CMYK has four components, all in the range 0-255: cyan (C),
magenta (M), yellow (Y) and black (K). Cyan, magenta and yellow are
called subtractive colors; the CMYK color model creates color by
starting with a white surface and then subtracting color by
applying the appropriate components. While combining cyan, magenta
and yellow gives the color black, subtracting one or more will
yield any other color. When combined in various percentages, these
three colors can create the entire spectrum of colors.</p>
<p>Mixing 100 percent of cyan, magenta and yellow <i>does</i>
produce black, but the result is unsatisfactory since it wastes
ink, increases drying time, and gives a muddy colour when printing.
For that reason, black is added in professional printing to provide
a solid black tone; hence the term 'four color process'.</p>
<p>In addition to the standard CMYK model, Qt provides an
alpha-channel to feature <a href="#alpha-blended-drawing">alpha-blended drawing</a>.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="Spec-enum" />QColor.Spec</h3><p>The type of color specified, either RGB, HSV, CMYK or HSL.</p>
<table class="valuelist">
<tr>
<th class="tblConst">Constant</th>
<th class="tblVal">Value</th>
</tr>
<tr>
<td class="topAlign"><tt>QColor.Rgb</tt></td>
<td class="topAlign"><tt>1</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QColor.Hsv</tt></td>
<td class="topAlign"><tt>2</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QColor.Cmyk</tt></td>
<td class="topAlign"><tt>3</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QColor.Hsl</tt></td>
<td class="topAlign"><tt>4</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QColor.Invalid</tt></td>
<td class="topAlign"><tt>0</tt></td>
</tr>
</table>
<p><b>See also</b> <a href="qcolor.html#spec">spec</a>() and
<a href="qcolor.html#convertTo">convertTo</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QColor" />QColor.__init__ (<i>self</i>, <a href="qt.html#GlobalColor-enum">Qt.GlobalColor</a> <i>color</i>)</h3><p>Constructs an invalid color with the RGB value (0, 0, 0). An
invalid color is a color that is not properly set up for the
underlying window system.</p>
<p>The alpha value of an invalid color is unspecified.</p>
<p><b>See also</b> <a href="qcolor.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="QColor-2" />QColor.__init__ (<i>self</i>, int <i>rgb</i>)</h3><p>Constructs a color with the RGB value <i>r</i>, <i>g</i>,
<i>b</i>, and the alpha-channel (transparency) value of
<i>a</i>.</p>
<p>The color is left invalid if any of the arguments are
invalid.</p>
<p><b>See also</b> <a href="qcolor.html#setRgba">setRgba</a>() and
<a href="qcolor.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="QColor-3" />QColor.__init__ (<i>self</i>, QVariant <i>variant</i>)</h3><p>Constructs a color with the value <i>color</i>. The alpha
component is ignored and set to solid.</p>
<p><b>See also</b> <a href="qcolor.html#fromRgb">fromRgb</a>() and
<a href="qcolor.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="QColor-4" />QColor.__init__ (<i>self</i>)</h3><p>Constructs a named color in the same way as <a href="qcolor.html#setNamedColor">setNamedColor</a>() using the given
<i>name</i>.</p>
<p>The color is left invalid if the <i>name</i> cannot be
parsed.</p>
<p><b>See also</b> <a href="qcolor.html#setNamedColor">setNamedColor</a>(), <a href="qcolor.html#name">name</a>(), and <a href="qcolor.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="QColor-5" />QColor.__init__ (<i>self</i>, int <i>r</i>, int <i>g</i>, int <i>b</i>, int <i>alpha</i> = 255)</h3><p>Constructs a named color in the same way as <a href="qcolor.html#setNamedColor">setNamedColor</a>() using the given
<i>name</i>.</p>
<p>The color is left invalid if the <i>name</i> cannot be
parsed.</p>
<p><b>See also</b> <a href="qcolor.html#setNamedColor">setNamedColor</a>(), <a href="qcolor.html#name">name</a>(), and <a href="qcolor.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="QColor-6" />QColor.__init__ (<i>self</i>, QString <i>aname</i>)</h3><p>Constructs a color that is a copy of <i>color</i>.</p>
<p><b>See also</b> <a href="qcolor.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="QColor-7" />QColor.__init__ (<i>self</i>, <a href="qcolor.html">QColor</a> <i>acolor</i>)</h3><h3 class="fn"><a name="allowX11ColorNames" />bool QColor.allowX11ColorNames ()</h3><p>Returns true if <a href="qcolor.html#setNamedColor">setNamedColor</a>() is allowed to look
up colors in the X11 color database. By default, this function
returns false.</p>
<p><b>Note:</b> This function is only available on the X11
platform.</p>
<p><b>See also</b> <a href="qcolor.html#setAllowX11ColorNames">setAllowX11ColorNames</a>().</p>
<h3 class="fn"><a name="alpha" />int QColor.alpha (<i>self</i>)</h3><p>Returns the alpha color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#setAlpha">setAlpha</a>(),
<a href="qcolor.html#alphaF">alphaF</a>(), and <a href="qcolor.html#alpha-blended-drawing">Alpha-Blended Drawing</a>.</p>
<h3 class="fn"><a name="alphaF" />float QColor.alphaF (<i>self</i>)</h3><p>Returns the alpha color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#setAlphaF">setAlphaF</a>(),
<a href="qcolor.html#alpha">alpha</a>(), and <a href="qcolor.html#alpha-blended-drawing">Alpha-Blended Drawing</a>.</p>
<h3 class="fn"><a name="black" />int QColor.black (<i>self</i>)</h3><p>Returns the black color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#blackF">blackF</a>(),
<a href="qcolor.html#getCmyk">getCmyk</a>(), and <a href="qcolor.html#the-cmyk-color-model">The CMYK Color Model</a>.</p>
<h3 class="fn"><a name="blackF" />float QColor.blackF (<i>self</i>)</h3><p>Returns the black color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#black">black</a>(),
<a href="qcolor.html#getCmykF">getCmykF</a>(), and <a href="qcolor.html#the-cmyk-color-model">The CMYK Color Model</a>.</p>
<h3 class="fn"><a name="blue" />int QColor.blue (<i>self</i>)</h3><p>Returns the blue color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#setBlue">setBlue</a>(),
<a href="qcolor.html#blueF">blueF</a>(), and <a href="qcolor.html#getRgb">getRgb</a>().</p>
<h3 class="fn"><a name="blueF" />float QColor.blueF (<i>self</i>)</h3><p>Returns the blue color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#setBlueF">setBlueF</a>(),
<a href="qcolor.html#blue">blue</a>(), and <a href="qcolor.html#getRgbF">getRgbF</a>().</p>
<h3 class="fn"><a name="colorNames" />QStringList QColor.colorNames ()</h3><p>Returns a <a href="qstringlist.html">QStringList</a> containing
the color names Qt knows about.</p>
<p><b>See also</b> <a href="qcolor.html#predefined-colors">Predefined Colors</a>.</p>
<h3 class="fn"><a name="convertTo" /><a href="qcolor.html">QColor</a> QColor.convertTo (<i>self</i>, <a href="qcolor.html#Spec-enum">Spec</a> <i>colorSpec</i>)</h3><p>Creates a copy of <i>this</i> color in the format specified by
<i>colorSpec</i>.</p>
<p><b>See also</b> <a href="qcolor.html#spec">spec</a>(), <a href="qcolor.html#toCmyk">toCmyk</a>(), <a href="qcolor.html#toHsv">toHsv</a>(), <a href="qcolor.html#toRgb">toRgb</a>(), and <a href="qcolor.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="cyan" />int QColor.cyan (<i>self</i>)</h3><p>Returns the cyan color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#cyanF">cyanF</a>(),
<a href="qcolor.html#getCmyk">getCmyk</a>(), and <a href="qcolor.html#the-cmyk-color-model">The CMYK Color Model</a>.</p>
<h3 class="fn"><a name="cyanF" />float QColor.cyanF (<i>self</i>)</h3><p>Returns the cyan color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#cyan">cyan</a>(), <a href="qcolor.html#getCmykF">getCmykF</a>(), and <a href="qcolor.html#the-cmyk-color-model">The CMYK Color Model</a>.</p>
<h3 class="fn"><a name="dark" /><a href="qcolor.html">QColor</a> QColor.dark (<i>self</i>, int <i>factor</i> = 200)</h3><h3 class="fn"><a name="darker" /><a href="qcolor.html">QColor</a> QColor.darker (<i>self</i>, int <i>factor</i> = 200)</h3><p>Returns a darker (or lighter) color, but does not change this
object.</p>
<p>If the <i>factor</i> is greater than 100, this functions returns
a darker color. Setting <i>factor</i> to 300 returns a color that
has one-third the brightness. If the <i>factor</i> is less than
100, the return color is lighter, but we recommend using the
<a href="qcolor.html#lighter">lighter</a>() function for this
purpose. If the <i>factor</i> is 0 or negative, the return value is
unspecified.</p>
<p>The function converts the current RGB color to HSV, divides the
value (V) component by <i>factor</i> and converts the color back to
RGB.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also</b> <a href="qcolor.html#lighter">lighter</a>() and
<a href="qcolor.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="fromCmyk" /><a href="qcolor.html">QColor</a> QColor.fromCmyk (int <i>c</i>, int <i>m</i>, int <i>y</i>, int <i>k</i>, int <i>alpha</i> = 255)</h3><p>Static convenience function that returns a <a href="qcolor.html">QColor</a> constructed from the given CMYK color
values: <i>c</i> (cyan), <i>m</i> (magenta), <i>y</i> (yellow),
<i>k</i> (black), and <i>a</i> (alpha-channel, i.e.
transparency).</p>
<p>All the values must be in the range 0-255.</p>
<p><b>See also</b> <a href="qcolor.html#toCmyk">toCmyk</a>(),
<a href="qcolor.html#fromCmykF">fromCmykF</a>(), <a href="qcolor.html#isValid">isValid</a>(), and <a href="qcolor.html#the-cmyk-color-model">The CMYK Color Model</a>.</p>
<h3 class="fn"><a name="fromCmykF" /><a href="qcolor.html">QColor</a> QColor.fromCmykF (float <i>c</i>, float <i>m</i>, float <i>y</i>, float <i>k</i>, float <i>alpha</i> = 1)</h3><p>This is an overloaded function.</p>
<p>Static convenience function that returns a <a href="qcolor.html">QColor</a> constructed from the given CMYK color
values: <i>c</i> (cyan), <i>m</i> (magenta), <i>y</i> (yellow),
<i>k</i> (black), and <i>a</i> (alpha-channel, i.e.
transparency).</p>
<p>All the values must be in the range 0.0-1.0.</p>
<p><b>See also</b> <a href="qcolor.html#toCmyk">toCmyk</a>(),
<a href="qcolor.html#fromCmyk">fromCmyk</a>(), <a href="qcolor.html#isValid">isValid</a>(), and <a href="qcolor.html#the-cmyk-color-model">The CMYK Color Model</a>.</p>
<h3 class="fn"><a name="fromHsl" /><a href="qcolor.html">QColor</a> QColor.fromHsl (int <i>h</i>, int <i>s</i>, int <i>l</i>, int <i>alpha</i> = 255)</h3><p>Static convenience function that returns a <a href="qcolor.html">QColor</a> constructed from the HSV color values,
<i>h</i> (hue), <i>s</i> (saturation), <i>l</i> (lightness), and
<i>a</i> (alpha-channel, i.e. transparency).</p>
<p>The value of <i>s</i>, <i>l</i>, and <i>a</i> must all be in the
range 0-255; the value of <i>h</i> must be in the range 0-359.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qcolor.html#toHsl">toHsl</a>(),
<a href="qcolor.html#fromHslF">fromHslF</a>(), and <a href="qcolor.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="fromHslF" /><a href="qcolor.html">QColor</a> QColor.fromHslF (float <i>h</i>, float <i>s</i>, float <i>l</i>, float <i>alpha</i> = 1)</h3><p>This is an overloaded function.</p>
<p>Static convenience function that returns a <a href="qcolor.html">QColor</a> constructed from the HSV color values,
<i>h</i> (hue), <i>s</i> (saturation), <i>l</i> (lightness), and
<i>a</i> (alpha-channel, i.e. transparency).</p>
<p>All the values must be in the range 0.0-1.0.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qcolor.html#toHsl">toHsl</a>(),
<a href="qcolor.html#fromHsl">fromHsl</a>(), and <a href="qcolor.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="fromHsv" /><a href="qcolor.html">QColor</a> QColor.fromHsv (int <i>h</i>, int <i>s</i>, int <i>v</i>, int <i>alpha</i> = 255)</h3><p>Static convenience function that returns a <a href="qcolor.html">QColor</a> constructed from the HSV color values,
<i>h</i> (hue), <i>s</i> (saturation), <i>v</i> (value), and
<i>a</i> (alpha-channel, i.e. transparency).</p>
<p>The value of <i>s</i>, <i>v</i>, and <i>a</i> must all be in the
range 0-255; the value of <i>h</i> must be in the range 0-359.</p>
<p><b>See also</b> <a href="qcolor.html#toHsv">toHsv</a>(),
<a href="qcolor.html#fromHsvF">fromHsvF</a>(), <a href="qcolor.html#isValid">isValid</a>(), and <a href="qcolor.html#the-hsv-color-model">The HSV Color Model</a>.</p>
<h3 class="fn"><a name="fromHsvF" /><a href="qcolor.html">QColor</a> QColor.fromHsvF (float <i>h</i>, float <i>s</i>, float <i>v</i>, float <i>alpha</i> = 1)</h3><p>This is an overloaded function.</p>
<p>Static convenience function that returns a <a href="qcolor.html">QColor</a> constructed from the HSV color values,
<i>h</i> (hue), <i>s</i> (saturation), <i>v</i> (value), and
<i>a</i> (alpha-channel, i.e. transparency).</p>
<p>All the values must be in the range 0.0-1.0.</p>
<p><b>See also</b> <a href="qcolor.html#toHsv">toHsv</a>(),
<a href="qcolor.html#fromHsv">fromHsv</a>(), <a href="qcolor.html#isValid">isValid</a>(), and <a href="qcolor.html#the-hsv-color-model">The HSV Color Model</a>.</p>
<h3 class="fn"><a name="fromRgb" /><a href="qcolor.html">QColor</a> QColor.fromRgb (int <i>rgb</i>)</h3><p>Static convenience function that returns a <a href="qcolor.html">QColor</a> constructed from the given <a href="qcolor.html#QRgb-typedef">QRgb</a> value <i>rgb</i>.</p>
<p>The alpha component of <i>rgb</i> is ignored (i.e. it is
automatically set to 255), use the <a href="qcolor.html#fromRgba">fromRgba</a>() function to include the
alpha-channel specified by the given <a href="qcolor.html#QRgb-typedef">QRgb</a> value.</p>
<p><b>See also</b> <a href="qcolor.html#fromRgba">fromRgba</a>(),
<a href="qcolor.html#fromRgbF">fromRgbF</a>(), <a href="qcolor.html#toRgb">toRgb</a>(), and <a href="qcolor.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="fromRgb-2" /><a href="qcolor.html">QColor</a> QColor.fromRgb (int <i>r</i>, int <i>g</i>, int <i>b</i>, int <i>alpha</i> = 255)</h3><p>Static convenience function that returns a <a href="qcolor.html">QColor</a> constructed from the RGB color values,
<i>r</i> (red), <i>g</i> (green), <i>b</i> (blue), and <i>a</i>
(alpha-channel, i.e. transparency).</p>
<p>All the values must be in the range 0-255.</p>
<p><b>See also</b> <a href="qcolor.html#toRgb">toRgb</a>(),
<a href="qcolor.html#fromRgbF">fromRgbF</a>(), and <a href="qcolor.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="fromRgba" /><a href="qcolor.html">QColor</a> QColor.fromRgba (int <i>rgba</i>)</h3><p>Static convenience function that returns a <a href="qcolor.html">QColor</a> constructed from the given <a href="qcolor.html#QRgb-typedef">QRgb</a> value <i>rgba</i>.</p>
<p>Unlike the <a href="qcolor.html#fromRgb">fromRgb</a>() function,
the alpha-channel specified by the given <a href="qcolor.html#QRgb-typedef">QRgb</a> value is included.</p>
<p><b>See also</b> <a href="qcolor.html#fromRgb">fromRgb</a>() and
<a href="qcolor.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="fromRgbF" /><a href="qcolor.html">QColor</a> QColor.fromRgbF (float <i>r</i>, float <i>g</i>, float <i>b</i>, float <i>alpha</i> = 1)</h3><p>Static convenience function that returns a <a href="qcolor.html">QColor</a> constructed from the RGB color values,
<i>r</i> (red), <i>g</i> (green), <i>b</i> (blue), and <i>a</i>
(alpha-channel, i.e. transparency).</p>
<p>All the values must be in the range 0.0-1.0.</p>
<p><b>See also</b> <a href="qcolor.html#fromRgb">fromRgb</a>(),
<a href="qcolor.html#toRgb">toRgb</a>(), and <a href="qcolor.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="getCmyk" />(int <i>c</i>, int <i>m</i>, int <i>y</i>, int <i>k</i>, int <i>alpha</i>) QColor.getCmyk (<i>self</i>)</h3><p>Sets the contents pointed to by <i>c</i>, <i>m</i>, <i>y</i>,
<i>k</i>, and <i>a</i>, to the cyan, magenta, yellow, black, and
alpha-channel (transparency) components of the color's CMYK
value.</p>
<p>These components can be retrieved individually using the
<a href="qcolor.html#cyan">cyan</a>(), <a href="qcolor.html#magenta">magenta</a>(), <a href="qcolor.html#yellow">yellow</a>(), <a href="qcolor.html#black">black</a>() and <a href="qcolor.html#alpha">alpha</a>() functions.</p>
<p><b>See also</b> <a href="qcolor.html#setCmyk">setCmyk</a>() and
<a href="qcolor.html#the-cmyk-color-model">The CMYK Color
Model</a>.</p>
<h3 class="fn"><a name="getCmykF" />(float <i>c</i>, float <i>m</i>, float <i>y</i>, float <i>k</i>, float <i>alpha</i>) QColor.getCmykF (<i>self</i>)</h3><p>Sets the contents pointed to by <i>c</i>, <i>m</i>, <i>y</i>,
<i>k</i>, and <i>a</i>, to the cyan, magenta, yellow, black, and
alpha-channel (transparency) components of the color's CMYK
value.</p>
<p>These components can be retrieved individually using the
<a href="qcolor.html#cyanF">cyanF</a>(), <a href="qcolor.html#magentaF">magentaF</a>(), <a href="qcolor.html#yellowF">yellowF</a>(), <a href="qcolor.html#blackF">blackF</a>() and <a href="qcolor.html#alphaF">alphaF</a>() functions.</p>
<p><b>See also</b> <a href="qcolor.html#setCmykF">setCmykF</a>()
and <a href="qcolor.html#the-cmyk-color-model">The CMYK Color
Model</a>.</p>
<h3 class="fn"><a name="getHsl" />(int <i>h</i>, int <i>s</i>, int <i>l</i>, int <i>alpha</i>) QColor.getHsl (<i>self</i>)</h3><p>Sets the contents pointed to by <i>h</i>, <i>s</i>, <i>l</i>,
and <i>a</i>, to the hue, saturation, lightness, and alpha-channel
(transparency) components of the color's HSL value.</p>
<p>These components can be retrieved individually using the
hueHsl(), saturationHsl(), <a href="qcolor.html#lightness">lightness</a>() and <a href="qcolor.html#alpha">alpha</a>() functions.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qcolor.html#setHsl">setHsl</a>().</p>
<h3 class="fn"><a name="getHslF" />(float <i>h</i>, float <i>s</i>, float <i>l</i>, float <i>alpha</i>) QColor.getHslF (<i>self</i>)</h3><p>Sets the contents pointed to by <i>h</i>, <i>s</i>, <i>l</i>,
and <i>a</i>, to the hue, saturation, lightness, and alpha-channel
(transparency) components of the color's HSL value.</p>
<p>These components can be retrieved individually using the
hueHslF(), saturationHslF(), <a href="qcolor.html#lightnessF">lightnessF</a>() and <a href="qcolor.html#alphaF">alphaF</a>() functions.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qcolor.html#setHsl">setHsl</a>().</p>
<h3 class="fn"><a name="getHsv" />(int <i>h</i>, int <i>s</i>, int <i>v</i>, int <i>alpha</i>) QColor.getHsv (<i>self</i>)</h3><p>Sets the contents pointed to by <i>h</i>, <i>s</i>, <i>v</i>,
and <i>a</i>, to the hue, saturation, value, and alpha-channel
(transparency) components of the color's HSV value.</p>
<p>These components can be retrieved individually using the
<a href="qcolor.html#hue">hue</a>(), <a href="qcolor.html#saturation">saturation</a>(), <a href="qcolor.html#value">value</a>() and <a href="qcolor.html#alpha">alpha</a>() functions.</p>
<p><b>See also</b> <a href="qcolor.html#setHsv">setHsv</a>() and
<a href="qcolor.html#the-hsv-color-model">The HSV Color
Model</a>.</p>
<h3 class="fn"><a name="getHsvF" />(float <i>h</i>, float <i>s</i>, float <i>v</i>, float <i>alpha</i>) QColor.getHsvF (<i>self</i>)</h3><p>Sets the contents pointed to by <i>h</i>, <i>s</i>, <i>v</i>,
and <i>a</i>, to the hue, saturation, value, and alpha-channel
(transparency) components of the color's HSV value.</p>
<p>These components can be retrieved individually using the
<a href="qcolor.html#hueF">hueF</a>(), <a href="qcolor.html#saturationF">saturationF</a>(), <a href="qcolor.html#valueF">valueF</a>() and <a href="qcolor.html#alphaF">alphaF</a>() functions.</p>
<p><b>See also</b> <a href="qcolor.html#setHsv">setHsv</a>() and
<a href="qcolor.html#the-hsv-color-model">The HSV Color
Model</a>.</p>
<h3 class="fn"><a name="getRgb" />(int <i>r</i>, int <i>g</i>, int <i>b</i>, int <i>alpha</i>) QColor.getRgb (<i>self</i>)</h3><p>Sets the contents pointed to by <i>r</i>, <i>g</i>, <i>b</i>,
and <i>a</i>, to the red, green, blue, and alpha-channel
(transparency) components of the color's RGB value.</p>
<p>These components can be retrieved individually using the
<a href="qcolor.html#red">red</a>(), <a href="qcolor.html#green">green</a>(), <a href="qcolor.html#blue">blue</a>() and <a href="qcolor.html#alpha">alpha</a>() functions.</p>
<p><b>See also</b> <a href="qcolor.html#rgb">rgb</a>() and <a href="qcolor.html#setRgb">setRgb</a>().</p>
<h3 class="fn"><a name="getRgbF" />(float <i>r</i>, float <i>g</i>, float <i>b</i>, float <i>alpha</i>) QColor.getRgbF (<i>self</i>)</h3><p>Sets the contents pointed to by <i>r</i>, <i>g</i>, <i>b</i>,
and <i>a</i>, to the red, green, blue, and alpha-channel
(transparency) components of the color's RGB value.</p>
<p>These components can be retrieved individually using the
<a href="qcolor.html#redF">redF</a>(), <a href="qcolor.html#greenF">greenF</a>(), <a href="qcolor.html#blueF">blueF</a>() and <a href="qcolor.html#alphaF">alphaF</a>() functions.</p>
<p><b>See also</b> <a href="qcolor.html#rgb">rgb</a>() and <a href="qcolor.html#setRgb">setRgb</a>().</p>
<h3 class="fn"><a name="green" />int QColor.green (<i>self</i>)</h3><p>Returns the green color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#setGreen">setGreen</a>(),
<a href="qcolor.html#greenF">greenF</a>(), and <a href="qcolor.html#getRgb">getRgb</a>().</p>
<h3 class="fn"><a name="greenF" />float QColor.greenF (<i>self</i>)</h3><p>Returns the green color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#setGreenF">setGreenF</a>(),
<a href="qcolor.html#green">green</a>(), and <a href="qcolor.html#getRgbF">getRgbF</a>().</p>
<h3 class="fn"><a name="hslHue" />int QColor.hslHue (<i>self</i>)</h3><p>Returns the hue color component of this color.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qcolor.html#getHslF">getHslF</a>() and
<a href="qcolor.html#getHsl">getHsl</a>().</p>
<h3 class="fn"><a name="hslHueF" />float QColor.hslHueF (<i>self</i>)</h3><p>Returns the hue color component of this color.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qcolor.html#hue">hue</a>() and <a href="qcolor.html#getHslF">getHslF</a>().</p>
<h3 class="fn"><a name="hslSaturation" />int QColor.hslSaturation (<i>self</i>)</h3><p>Returns the saturation color component of this color.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qcolor.html#saturationF">saturationF</a>(), <a href="qcolor.html#getHsv">getHsv</a>(), and <a href="qcolor.html#the-hsv-color-model">The HSV Color Model</a>.</p>
<h3 class="fn"><a name="hslSaturationF" />float QColor.hslSaturationF (<i>self</i>)</h3><p>Returns the saturation color component of this color.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qcolor.html#saturationF">saturationF</a>() and <a href="qcolor.html#getHslF">getHslF</a>().</p>
<h3 class="fn"><a name="hsvHue" />int QColor.hsvHue (<i>self</i>)</h3><p>Returns the hue color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#hueF">hueF</a>(), <a href="qcolor.html#getHsv">getHsv</a>(), and <a href="qcolor.html#the-hsv-color-model">The HSV Color Model</a>.</p>
<h3 class="fn"><a name="hsvHueF" />float QColor.hsvHueF (<i>self</i>)</h3><p>Returns the hue color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#hue">hue</a>(), <a href="qcolor.html#getHsvF">getHsvF</a>(), and <a href="qcolor.html#the-hsv-color-model">The HSV Color Model</a>.</p>
<h3 class="fn"><a name="hsvSaturation" />int QColor.hsvSaturation (<i>self</i>)</h3><p>Returns the saturation color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#saturationF">saturationF</a>(), <a href="qcolor.html#getHsv">getHsv</a>(), and <a href="qcolor.html#the-hsv-color-model">The HSV Color Model</a>.</p>
<h3 class="fn"><a name="hsvSaturationF" />float QColor.hsvSaturationF (<i>self</i>)</h3><p>Returns the saturation color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#saturation">saturation</a>(), <a href="qcolor.html#getHsvF">getHsvF</a>(), and <a href="qcolor.html#the-hsv-color-model">The HSV Color Model</a>.</p>
<h3 class="fn"><a name="hue" />int QColor.hue (<i>self</i>)</h3><p>Returns the hue color component of this color.</p>
<p>The color is implicitly converted to HSV.</p>
<p><b>See also</b> <a href="qcolor.html#hsvHue">hsvHue</a>(),
<a href="qcolor.html#hueF">hueF</a>(), <a href="qcolor.html#getHsv">getHsv</a>(), and <a href="qcolor.html#the-hsv-color-model">The HSV Color Model</a>.</p>
<h3 class="fn"><a name="hueF" />float QColor.hueF (<i>self</i>)</h3><p>Returns the hue color component of this color.</p>
<p>The color is implicitly converted to HSV.</p>
<p><b>See also</b> <a href="qcolor.html#hsvHueF">hsvHueF</a>(),
<a href="qcolor.html#hue">hue</a>(), <a href="qcolor.html#getHsvF">getHsvF</a>(), and <a href="qcolor.html#the-hsv-color-model">The HSV Color Model</a>.</p>
<h3 class="fn"><a name="isValid" />bool QColor.isValid (<i>self</i>)</h3><p>Returns true if the color is valid; otherwise returns false.</p>
<h3 class="fn"><a name="isValidColor" />bool QColor.isValidColor (QString <i>name</i>)</h3><p>Returns true if the <i>name</i> is a valid color name and can be
used to construct a valid <a href="qcolor.html">QColor</a> object,
otherwise returns false.</p>
<p>It uses the same algorithm used in <a href="qcolor.html#setNamedColor">setNamedColor</a>().</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also</b> <a href="qcolor.html#setNamedColor">setNamedColor</a>().</p>
<h3 class="fn"><a name="light" /><a href="qcolor.html">QColor</a> QColor.light (<i>self</i>, int <i>factor</i> = 150)</h3><h3 class="fn"><a name="lighter" /><a href="qcolor.html">QColor</a> QColor.lighter (<i>self</i>, int <i>factor</i> = 150)</h3><p>Returns a lighter (or darker) color, but does not change this
object.</p>
<p>If the <i>factor</i> is greater than 100, this functions returns
a lighter color. Setting <i>factor</i> to 150 returns a color that
is 50% brighter. If the <i>factor</i> is less than 100, the return
color is darker, but we recommend using the <a href="qcolor.html#darker">darker</a>() function for this purpose. If the
<i>factor</i> is 0 or negative, the return value is
unspecified.</p>
<p>The function converts the current RGB color to HSV, multiplies
the value (V) component by <i>factor</i> and converts the color
back to RGB.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also</b> <a href="qcolor.html#darker">darker</a>() and
<a href="qcolor.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="lightness" />int QColor.lightness (<i>self</i>)</h3><p>Returns the lightness color component of this color.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qcolor.html#lightnessF">lightnessF</a>() and <a href="qcolor.html#getHsl">getHsl</a>().</p>
<h3 class="fn"><a name="lightnessF" />float QColor.lightnessF (<i>self</i>)</h3><p>Returns the lightness color component of this color.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qcolor.html#value">value</a>() and
<a href="qcolor.html#getHslF">getHslF</a>().</p>
<h3 class="fn"><a name="magenta" />int QColor.magenta (<i>self</i>)</h3><p>Returns the magenta color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#magentaF">magentaF</a>(),
<a href="qcolor.html#getCmyk">getCmyk</a>(), and <a href="qcolor.html#the-cmyk-color-model">The CMYK Color Model</a>.</p>
<h3 class="fn"><a name="magentaF" />float QColor.magentaF (<i>self</i>)</h3><p>Returns the magenta color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#magenta">magenta</a>(),
<a href="qcolor.html#getCmykF">getCmykF</a>(), and <a href="qcolor.html#the-cmyk-color-model">The CMYK Color Model</a>.</p>
<h3 class="fn"><a name="name" />QString QColor.name (<i>self</i>)</h3><p>Returns the name of the color in the format "#RRGGBB"; i.e. a
"#" character followed by three two-digit hexadecimal numbers.</p>
<p><b>See also</b> <a href="qcolor.html#setNamedColor">setNamedColor</a>().</p>
<h3 class="fn"><a name="red" />int QColor.red (<i>self</i>)</h3><p>Returns the red color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#setRed">setRed</a>(),
<a href="qcolor.html#redF">redF</a>(), and <a href="qcolor.html#getRgb">getRgb</a>().</p>
<h3 class="fn"><a name="redF" />float QColor.redF (<i>self</i>)</h3><p>Returns the red color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#setRedF">setRedF</a>(),
<a href="qcolor.html#red">red</a>(), and <a href="qcolor.html#getRgbF">getRgbF</a>().</p>
<h3 class="fn"><a name="rgb" />int QColor.rgb (<i>self</i>)</h3><p>Returns the RGB value of the color. The alpha value is
opaque.</p>
<p><b>See also</b> <a href="qcolor.html#setRgb">setRgb</a>(),
<a href="qcolor.html#getRgb">getRgb</a>(), and <a href="qcolor.html#rgba">rgba</a>().</p>
<h3 class="fn"><a name="rgba" />int QColor.rgba (<i>self</i>)</h3><p>Returns the RGB value of the color, including its alpha.</p>
<p>For an invalid color, the alpha value of the returned color is
unspecified.</p>
<p><b>See also</b> <a href="qcolor.html#setRgba">setRgba</a>() and
<a href="qcolor.html#rgb">rgb</a>().</p>
<h3 class="fn"><a name="saturation" />int QColor.saturation (<i>self</i>)</h3><p>Returns the saturation color component of this color.</p>
<p>The color is implicitly converted to HSV.</p>
<p><b>See also</b> <a href="qcolor.html#hsvSaturation">hsvSaturation</a>(), <a href="qcolor.html#saturationF">saturationF</a>(), <a href="qcolor.html#getHsv">getHsv</a>(), and <a href="qcolor.html#the-hsv-color-model">The HSV Color Model</a>.</p>
<h3 class="fn"><a name="saturationF" />float QColor.saturationF (<i>self</i>)</h3><p>Returns the saturation color component of this color.</p>
<p>The color is implicitly converted to HSV.</p>
<p><b>See also</b> <a href="qcolor.html#hsvSaturationF">hsvSaturationF</a>(), <a href="qcolor.html#saturation">saturation</a>(), <a href="qcolor.html#getHsvF">getHsvF</a>(), and <a href="qcolor.html#the-hsv-color-model">The HSV Color Model</a>.</p>
<h3 class="fn"><a name="setAllowX11ColorNames" />QColor.setAllowX11ColorNames (bool <i>enabled</i>)</h3><p>Allow <a href="qcolor.html#setNamedColor">setNamedColor</a>() to
look up colors in the X11 color database if <i>enabled</i>. By
default, <a href="qcolor.html#setNamedColor">setNamedColor</a>()
does <i>not</i> look up colors in the X11 color database.</p>
<p><b>Note:</b> This function is only available on the X11
platform.</p>
<p><b>See also</b> <a href="qcolor.html#setNamedColor">setNamedColor</a>() and <a href="qcolor.html#allowX11ColorNames">allowX11ColorNames</a>().</p>
<h3 class="fn"><a name="setAlpha" />QColor.setAlpha (<i>self</i>, int <i>alpha</i>)</h3><p>Sets the alpha of this color to <i>alpha</i>. Integer alpha is
specified in the range 0-255.</p>
<p><b>See also</b> <a href="qcolor.html#alpha">alpha</a>(),
<a href="qcolor.html#alphaF">alphaF</a>(), and <a href="qcolor.html#alpha-blended-drawing">Alpha-Blended Drawing</a>.</p>
<h3 class="fn"><a name="setAlphaF" />QColor.setAlphaF (<i>self</i>, float <i>alpha</i>)</h3><p>Sets the alpha of this color to <i>alpha</i>. qreal alpha is
specified in the range 0.0-1.0.</p>
<p><b>See also</b> <a href="qcolor.html#alphaF">alphaF</a>(),
<a href="qcolor.html#alpha">alpha</a>(), and <a href="qcolor.html#alpha-blended-drawing">Alpha-Blended Drawing</a>.</p>
<h3 class="fn"><a name="setBlue" />QColor.setBlue (<i>self</i>, int <i>blue</i>)</h3><p>Sets the blue color component of this color to <i>blue</i>.
Integer components are specified in the range 0-255.</p>
<p><b>See also</b> <a href="qcolor.html#blue">blue</a>(), <a href="qcolor.html#blueF">blueF</a>(), and <a href="qcolor.html#setRgb">setRgb</a>().</p>
<h3 class="fn"><a name="setBlueF" />QColor.setBlueF (<i>self</i>, float <i>blue</i>)</h3><p>Sets the blue color component of this color to <i>blue</i>.
Float components are specified in the range 0.0-1.0.</p>
<p><b>See also</b> <a href="qcolor.html#blueF">blueF</a>(),
<a href="qcolor.html#blue">blue</a>(), and <a href="qcolor.html#setRgbF">setRgbF</a>().</p>
<h3 class="fn"><a name="setCmyk" />QColor.setCmyk (<i>self</i>, int <i>c</i>, int <i>m</i>, int <i>y</i>, int <i>k</i>, int <i>alpha</i> = 255)</h3><p>Sets the color to CMYK values, <i>c</i> (cyan), <i>m</i>
(magenta), <i>y</i> (yellow), <i>k</i> (black), and <i>a</i>
(alpha-channel, i.e. transparency).</p>
<p>All the values must be in the range 0-255.</p>
<p><b>See also</b> <a href="qcolor.html#getCmyk">getCmyk</a>(),
<a href="qcolor.html#setCmykF">setCmykF</a>(), and <a href="qcolor.html#the-cmyk-color-model">The CMYK Color Model</a>.</p>
<h3 class="fn"><a name="setCmykF" />QColor.setCmykF (<i>self</i>, float <i>c</i>, float <i>m</i>, float <i>y</i>, float <i>k</i>, float <i>alpha</i> = 1)</h3><p>This is an overloaded function.</p>
<p>Sets the color to CMYK values, <i>c</i> (cyan), <i>m</i>
(magenta), <i>y</i> (yellow), <i>k</i> (black), and <i>a</i>
(alpha-channel, i.e. transparency).</p>
<p>All the values must be in the range 0.0-1.0.</p>
<p><b>See also</b> <a href="qcolor.html#getCmykF">getCmykF</a>(),
<a href="qcolor.html#setCmyk">setCmyk</a>(), and <a href="qcolor.html#the-cmyk-color-model">The CMYK Color Model</a>.</p>
<h3 class="fn"><a name="setGreen" />QColor.setGreen (<i>self</i>, int <i>green</i>)</h3><p>Sets the green color component of this color to <i>green</i>.
Integer components are specified in the range 0-255.</p>
<p><b>See also</b> <a href="qcolor.html#green">green</a>(),
<a href="qcolor.html#greenF">greenF</a>(), and <a href="qcolor.html#setRgb">setRgb</a>().</p>
<h3 class="fn"><a name="setGreenF" />QColor.setGreenF (<i>self</i>, float <i>green</i>)</h3><p>Sets the green color component of this color to <i>green</i>.
Float components are specified in the range 0.0-1.0.</p>
<p><b>See also</b> <a href="qcolor.html#greenF">greenF</a>(),
<a href="qcolor.html#green">green</a>(), and <a href="qcolor.html#setRgbF">setRgbF</a>().</p>
<h3 class="fn"><a name="setHsl" />QColor.setHsl (<i>self</i>, int <i>h</i>, int <i>s</i>, int <i>l</i>, int <i>alpha</i> = 255)</h3><p>Sets a HSL color value; <i>h</i> is the hue, <i>s</i> is the
saturation, <i>l</i> is the lightness and <i>a</i> is the alpha
component of the HSL color.</p>
<p>The saturation, value and alpha-channel values must be in the
range 0-255, and the hue value must be greater than -1.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qcolor.html#getHsl">getHsl</a>() and
<a href="qcolor.html#setHslF">setHslF</a>().</p>
<h3 class="fn"><a name="setHslF" />QColor.setHslF (<i>self</i>, float <i>h</i>, float <i>s</i>, float <i>l</i>, float <i>alpha</i> = 1)</h3><p>Sets a HSL color lightness; <i>h</i> is the hue, <i>s</i> is the
saturation, <i>l</i> is the lightness and <i>a</i> is the alpha
component of the HSL color.</p>
<p>All the values must be in the range 0.0-1.0.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qcolor.html#getHslF">getHslF</a>() and
<a href="qcolor.html#setHsl">setHsl</a>().</p>
<h3 class="fn"><a name="setHsv" />QColor.setHsv (<i>self</i>, int <i>h</i>, int <i>s</i>, int <i>v</i>, int <i>alpha</i> = 255)</h3><p>Sets a HSV color value; <i>h</i> is the hue, <i>s</i> is the
saturation, <i>v</i> is the value and <i>a</i> is the alpha
component of the HSV color.</p>
<p>The saturation, value and alpha-channel values must be in the
range 0-255, and the hue value must be greater than -1.</p>
<p><b>See also</b> <a class="compat" href="qcolor-qt3.html#hsv">hsv</a>(), <a href="qcolor.html#getHsv">getHsv</a>(),
<a href="qcolor.html#setHsvF">setHsvF</a>(), and <a href="qcolor.html#the-hsv-color-model">The HSV Color Model</a>.</p>
<h3 class="fn"><a name="setHsvF" />QColor.setHsvF (<i>self</i>, float <i>h</i>, float <i>s</i>, float <i>v</i>, float <i>alpha</i> = 1)</h3><p>Sets a HSV color value; <i>h</i> is the hue, <i>s</i> is the
saturation, <i>v</i> is the value and <i>a</i> is the alpha
component of the HSV color.</p>
<p>All the values must be in the range 0.0-1.0.</p>
<p><b>See also</b> <a href="qcolor.html#getHsvF">getHsvF</a>(),
<a href="qcolor.html#setHsv">setHsv</a>(), and <a href="qcolor.html#the-hsv-color-model">The HSV Color Model</a>.</p>
<h3 class="fn"><a name="setNamedColor" />QColor.setNamedColor (<i>self</i>, QString <i>name</i>)</h3><p>Sets the RGB value of this <a href="qcolor.html">QColor</a> to
<i>name</i>, which may be in one of these formats:</p>
<ul>
<li>#RGB (each of R, G, and B is a single hex digit)</li>
<li>#RRGGBB</li>
<li>#RRRGGGBBB</li>
<li>#RRRRGGGGBBBB</li>
<li>A name from the list of colors defined in the list of <a href="http://www.w3.org/TR/SVG/types.html#ColorKeywords">SVG color
keyword names</a> provided by the World Wide Web Consortium; for
example, "steelblue" or "gainsboro". These color names work on all
platforms. Note that these color names are <i>not</i> the same as
defined by the <a href="qt.html#GlobalColor-enum">Qt.GlobalColor</a> enums, e.g. "green"
and <a href="qt.html#GlobalColor-enum">Qt.green</a> does not refer
to the same color.</li>
<li><tt>transparent</tt> - representing the absence of a
color.</li>
<li><i>X11 only</i>: If <a href="qcolor.html#allowX11ColorNames">allowX11ColorNames</a>() returns
true, any valid X11 color name. See the documentation for
<tt>XParseColor()</tt> for information about valid X11 color
names.</li>
</ul>
<p>The color is invalid if <i>name</i> cannot be parsed.</p>
<p><b>See also</b> <a href="qcolor.html#QColor">QColor</a>(),
<a href="qcolor.html#name">name</a>(), <a href="qcolor.html#isValid">isValid</a>(), and <a href="qcolor.html#allowX11ColorNames">allowX11ColorNames</a>().</p>
<h3 class="fn"><a name="setRed" />QColor.setRed (<i>self</i>, int <i>red</i>)</h3><p>Sets the red color component of this color to <i>red</i>.
Integer components are specified in the range 0-255.</p>
<p><b>See also</b> <a href="qcolor.html#red">red</a>(), <a href="qcolor.html#redF">redF</a>(), and <a href="qcolor.html#setRgb">setRgb</a>().</p>
<h3 class="fn"><a name="setRedF" />QColor.setRedF (<i>self</i>, float <i>red</i>)</h3><p>Sets the red color component of this color to <i>red</i>. Float
components are specified in the range 0.0-1.0.</p>
<p><b>See also</b> <a href="qcolor.html#redF">redF</a>(), <a href="qcolor.html#red">red</a>(), and <a href="qcolor.html#setRgbF">setRgbF</a>().</p>
<h3 class="fn"><a name="setRgb" />QColor.setRgb (<i>self</i>, int <i>r</i>, int <i>g</i>, int <i>b</i>, int <i>alpha</i> = 255)</h3><p>Sets the RGB value to <i>r</i>, <i>g</i>, <i>b</i> and the alpha
value to <i>a</i>.</p>
<p>All the values must be in the range 0-255.</p>
<p><b>See also</b> <a href="qcolor.html#rgb">rgb</a>(), <a href="qcolor.html#getRgb">getRgb</a>(), and <a href="qcolor.html#setRgbF">setRgbF</a>().</p>
<h3 class="fn"><a name="setRgb-2" />QColor.setRgb (<i>self</i>, int <i>rgb</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the RGB value to <i>rgb</i>. The alpha value is set to
opaque.</p>
<h3 class="fn"><a name="setRgba" />QColor.setRgba (<i>self</i>, int <i>rgba</i>)</h3><p>Sets the RGB value to <i>rgba</i>, including its alpha.</p>
<p><b>See also</b> <a href="qcolor.html#rgba">rgba</a>() and
<a href="qcolor.html#rgb">rgb</a>().</p>
<h3 class="fn"><a name="setRgbF" />QColor.setRgbF (<i>self</i>, float <i>r</i>, float <i>g</i>, float <i>b</i>, float <i>alpha</i> = 1)</h3><p>Sets the color channels of this color to <i>r</i> (red),
<i>g</i> (green), <i>b</i> (blue) and <i>a</i> (alpha,
transparency).</p>
<p>All values must be in the range 0.0-1.0.</p>
<p><b>See also</b> <a href="qcolor.html#rgb">rgb</a>(), <a href="qcolor.html#getRgbF">getRgbF</a>(), and <a href="qcolor.html#setRgb">setRgb</a>().</p>
<h3 class="fn"><a name="spec" /><a href="qcolor.html#Spec-enum">Spec</a> QColor.spec (<i>self</i>)</h3><p>Returns how the color was specified.</p>
<p><b>See also</b> <a href="qcolor.html#Spec-enum">Spec</a> and
<a href="qcolor.html#convertTo">convertTo</a>().</p>
<h3 class="fn"><a name="toCmyk" /><a href="qcolor.html">QColor</a> QColor.toCmyk (<i>self</i>)</h3><p>Creates and returns a CMYK <a href="qcolor.html">QColor</a>
based on this color.</p>
<p><b>See also</b> <a href="qcolor.html#fromCmyk">fromCmyk</a>(),
<a href="qcolor.html#convertTo">convertTo</a>(), <a href="qcolor.html#isValid">isValid</a>(), and <a href="qcolor.html#the-cmyk-color-model">The CMYK Color Model</a>.</p>
<h3 class="fn"><a name="toHsl" /><a href="qcolor.html">QColor</a> QColor.toHsl (<i>self</i>)</h3><p>Creates and returns an HSL <a href="qcolor.html">QColor</a>
based on this color.</p>
<p><b>See also</b> <a href="qcolor.html#fromHsl">fromHsl</a>(),
<a href="qcolor.html#convertTo">convertTo</a>(), and <a href="qcolor.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="toHsv" /><a href="qcolor.html">QColor</a> QColor.toHsv (<i>self</i>)</h3><p>Creates and returns an HSV <a href="qcolor.html">QColor</a>
based on this color.</p>
<p><b>See also</b> <a href="qcolor.html#fromHsv">fromHsv</a>(),
<a href="qcolor.html#convertTo">convertTo</a>(), <a href="qcolor.html#isValid">isValid</a>(), and <a href="qcolor.html#the-hsv-color-model">The HSV Color Model</a>.</p>
<h3 class="fn"><a name="toRgb" /><a href="qcolor.html">QColor</a> QColor.toRgb (<i>self</i>)</h3><p>Create and returns an RGB <a href="qcolor.html">QColor</a> based
on this color.</p>
<p><b>See also</b> <a href="qcolor.html#fromRgb">fromRgb</a>(),
<a href="qcolor.html#convertTo">convertTo</a>(), and <a href="qcolor.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="value" />int QColor.value (<i>self</i>)</h3><p>Returns the value color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#valueF">valueF</a>(),
<a href="qcolor.html#getHsv">getHsv</a>(), and <a href="qcolor.html#the-hsv-color-model">The HSV Color Model</a>.</p>
<h3 class="fn"><a name="valueF" />float QColor.valueF (<i>self</i>)</h3><p>Returns the value color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#value">value</a>(),
<a href="qcolor.html#getHsvF">getHsvF</a>(), and <a href="qcolor.html#the-hsv-color-model">The HSV Color Model</a>.</p>
<h3 class="fn"><a name="yellow" />int QColor.yellow (<i>self</i>)</h3><p>Returns the yellow color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#yellowF">yellowF</a>(),
<a href="qcolor.html#getCmyk">getCmyk</a>(), and <a href="qcolor.html#the-cmyk-color-model">The CMYK Color Model</a>.</p>
<h3 class="fn"><a name="yellowF" />float QColor.yellowF (<i>self</i>)</h3><p>Returns the yellow color component of this color.</p>
<p><b>See also</b> <a href="qcolor.html#yellow">yellow</a>(),
<a href="qcolor.html#getCmykF">getCmykF</a>(), and <a href="qcolor.html#the-cmyk-color-model">The CMYK Color Model</a>.</p>
<h3 class="fn"><a name="__eq__" />bool QColor.__eq__ (<i>self</i>, <a href="qcolor.html">QColor</a> <i>c</i>)</h3><h3 class="fn"><a name="__ne__" />bool QColor.__ne__ (<i>self</i>, <a href="qcolor.html">QColor</a> <i>c</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.12.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt 4.8.7</td></tr></table></div></address></body></html>
|