nex3/sass — Issue #293: incorrect examples for transparentize and opacify in documentation
Author: pixelass
Created: 2012-02-28 09:20:59+00:00
State: open

While playing around I found following incorrect examples in the sass reference.

http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html

copied from the examples:

The alpha channel of a color can be adjusted using the opacify and transparentize functions. For example:

```
$translucent-red: rgba(255, 0, 0, 0.5);
p {
color: opacify($translucent-red, 0.8);
background-color: transparentize($translucent-red, 50%);
}
```
is compiled to:

```
p {
color: rgba(255, 0, 0, 0.9);
background-color: rgba(255, 0, 0, 0.25); }

```

but it results as:

```
/*
Syntax error: Amount 50% must be between 0 and 1 for `transparentize'
*/
```

While

```
$translucent-red: rgba(255, 0, 0, 0.5);
p {
color: opacify($translucent-red, 0.8);
}
```

would result as:

```
p {
color: rgba(255, 0, 0, 0);
}
```

The documentation is as follows:

```
//transparentize
transparentize(rgba(0, 0, 0, 0.5), 0.1) => rgba(0, 0, 0, 0.4)
transparentize(rgba(0, 0, 0, 0.8), 0.2) => rgba(0, 0, 0, 0.6)
//opacify
opacify(rgba(0, 0, 0, 0.5), 0.1) => rgba(0, 0, 0, 0.6)
opacify(rgba(0, 0, 17, 0.8), 0.2) => #001
```
...yet it would be very useful to transparentize by 50% of the current value.
Is this an issue or just an incorrect example (as I assumed)?