Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
primozcigler committed Oct 7, 2013
1 parent b324007 commit 2a0503e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
33 changes: 24 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,35 @@ echo $myBlue->getCssGradient();
// IE Browsers
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#8cb3d9', endColorstr='#336699');

// Safari 4+, Chrome 1-9
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#8cb3d9), to(#336699));

// Safari 5.1+, Mobile Safari, Chrome 10+
background-image: -webkit-linear-gradient(top, #8cb3d9, #336699);

// Firefox 3.6+
background-image: -moz-linear-gradient(top, #8cb3d9, #336699);
// Standards
background-image: linear-gradient(to bottom, #8cb3d9, #336699);

*/

// IE 10+
background-image: -ms-linear-gradient(top, #8cb3d9, #336699);
```

However, if you want to support the ancient browsers (which has negligible market share and almost died out), you can set the second parameter to `TRUE`. This will output:

```php

// Opera 11.10+
background-image: -o-linear-gradient(top, #8cb3d9, #336699);
using phpColors\Color;
$myBlue = new Color("#336699");

// Get CSS
echo $myBlue->getCssGradient();
/* - Actual output doesn't have comments and is single line

background: #336699; /* fallback background */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#8cb3d9', endColorstr='#336699'); /* IE Browsers */
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#8cb3d9), to(#336699)); /* Safari 4+, Chrome 1-9 */
background-image: -webkit-linear-gradient(top, #8cb3d9, #336699); /* Safari 5.1+, Mobile Safari, Chrome 10+ */
background-image: -moz-linear-gradient(top, #8cb3d9, #336699); /* Firefox 3.6+ */
background-image: -ms-linear-gradient(top, #8cb3d9, #336699); /* IE 10+ */
background-image: -o-linear-gradient(top, #8cb3d9, #336699); /* Opera 11.10+ */
background-image: linear-gradient(to bottom, #8cb3d9, #336699); /* Standards */

*/

Expand Down
2 changes: 1 addition & 1 deletion demo/demo.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
}

.testDiv4{
<?= $myVintage->getCssGradient(30, "", "", true);?>
<?= $myVintage->getCssGradient(30, true);?>
color: <?=($myVintage->isDark() ? "#EEE":"#333")?>;
}
</style>
Expand Down
4 changes: 2 additions & 2 deletions src/color.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,12 @@ public function getRgb() {
* Returns the cross browser CSS3 gradient
* @param int Optional: percentage amount to light/darken the gradient
* @param string $prefix Optional: prefix for every lines
* @param string $suffix Optional: suffix for every lines
* @param boolean $vintageBrowsers Optional: include vendor prefixes for browsers that almost died out already
* @param string $suffix Optional: suffix for every lines
* @link http://caniuse.com/css-gradients Resource for the browser support
* @return string CSS3 gradient for chrome, safari, firefox, opera and IE10
*/
public function getCssGradient($amount = self::DEFAULT_ADJUST, $suffix = "" , $prefix = "", $vintageBrowsers = FALSE ) {
public function getCssGradient( $amount = self::DEFAULT_ADJUST, $vintageBrowsers = FALSE, $suffix = "" , $prefix = "" ) {

// Get the recommended gradient
$g = $this->makeGradient($amount);
Expand Down

0 comments on commit 2a0503e

Please sign in to comment.