|
@@ 465-482 (lines=18) @@
|
| 462 |
|
return $rgb; |
| 463 |
|
} |
| 464 |
|
|
| 465 |
|
function wpinv_hex_darker( $color, $factor = 30 ) { |
| 466 |
|
$base = wpinv_rgb_from_hex( $color ); |
| 467 |
|
$color = '#'; |
| 468 |
|
|
| 469 |
|
foreach ( $base as $k => $v ) { |
| 470 |
|
$amount = $v / 100; |
| 471 |
|
$amount = round( $amount * $factor ); |
| 472 |
|
$new_decimal = $v - $amount; |
| 473 |
|
|
| 474 |
|
$new_hex_component = dechex( $new_decimal ); |
| 475 |
|
if ( strlen( $new_hex_component ) < 2 ) { |
| 476 |
|
$new_hex_component = "0" . $new_hex_component; |
| 477 |
|
} |
| 478 |
|
$color .= $new_hex_component; |
| 479 |
|
} |
| 480 |
|
|
| 481 |
|
return $color; |
| 482 |
|
} |
| 483 |
|
|
| 484 |
|
function wpinv_hex_lighter( $color, $factor = 30 ) { |
| 485 |
|
$base = wpinv_rgb_from_hex( $color ); |
|
@@ 484-502 (lines=19) @@
|
| 481 |
|
return $color; |
| 482 |
|
} |
| 483 |
|
|
| 484 |
|
function wpinv_hex_lighter( $color, $factor = 30 ) { |
| 485 |
|
$base = wpinv_rgb_from_hex( $color ); |
| 486 |
|
$color = '#'; |
| 487 |
|
|
| 488 |
|
foreach ( $base as $k => $v ) { |
| 489 |
|
$amount = 255 - $v; |
| 490 |
|
$amount = $amount / 100; |
| 491 |
|
$amount = round( $amount * $factor ); |
| 492 |
|
$new_decimal = $v + $amount; |
| 493 |
|
|
| 494 |
|
$new_hex_component = dechex( $new_decimal ); |
| 495 |
|
if ( strlen( $new_hex_component ) < 2 ) { |
| 496 |
|
$new_hex_component = "0" . $new_hex_component; |
| 497 |
|
} |
| 498 |
|
$color .= $new_hex_component; |
| 499 |
|
} |
| 500 |
|
|
| 501 |
|
return $color; |
| 502 |
|
} |
| 503 |
|
|
| 504 |
|
function wpinv_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) { |
| 505 |
|
$hex = str_replace( '#', '', $color ); |