I love it when folks disregard standards.

For qlineargradient, you could monkeypatch Sass::Script::Lexer#special_fun
to recognize it as a syntactically non-standard function, but that would be
a little tricker than the Color monkeypatch.

On Tue, Jan 11, 2011 at 1:21 PM, Chris Eppstein <[email protected]> wrote:

> Regarding your first point, it can be done by "monkey patching" sass to
> change how colors behave when output.
>
> You could drop this into your compass config and I think it will do what
> you need (this overwrites the rgba_str method for all colors):
>
> module Sass::Script
>  class Color < Literal
>
>     def rgba_str
>       split = options[:style] == :compressed ? ',' : ', '
>       "rgba(#{rgb.join(split)}#{split}#{Number.round(alpha)*100}%)"
>     end
>
> end
> end
>
> Regarding the second point, that's not valid CSS syntax so the parser is
> going to barf on it, but you can kind of work around this by using strings
> (not pretty, but functional):
>
> background: unquote("qlineargradient(x1:#{$x1value}, y1:0, x2:1,
> y2:1, stop:0 #{$from-color}, stop: 0.4 gray, stop:1 green)");
>
> Hope that helps!
>
> chris
>
> For what it's worth, Sass 3.1 does have a named argument syntax as well and
> I hope we find an uptake in CSS someday of such a concept.
>
> On Tue, Jan 11, 2011 at 1:05 PM, abierbaum <[email protected]> wrote:
>
>> I have been using sass (and compass) on several mobile web app
>> projects and have loved it.  Recently I jumped back to a desktop
>> application using Qt and decided to see if I could use sass to
>> simplify the management of the stylesheets used in the application.
>>
>> Qt uses a CSS based styling syntax and most things are working fine.
>> But I have run into two issues that I don't know how to handle and
>> would appreciate any pointers or patches people could recommend that I
>> used.  (I must confess that I don't know ruby, so writing the code
>> myself would not be easy)
>>
>> 1) Qt's support for rgba() in a color requires a format like:
>>
>> QWidget {
>>  color: rgba(255, 50, 0, 50%);
>> }
>>
>> instead of the CSS standard
>>
>> QWidget {
>>  color: rgba(255, 50, 0, 0.5);
>> }
>>
>> I am fine with putting the colors into sass using the CSS formatting
>> method, but is there any way to override the output from sass so it
>> writes out the colors in the qt required format?
>>
>> 2) Qt stylesheets have a way to specify gradients that does not parse
>> as valid CSS.  (see:
>> http://doc.trolltech.com/latest/stylesheet-reference.html#gradient)
>>
>> For example:
>>
>> /* linear gradient from white to green */
>>  QTextEdit {
>>     background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
>>                 stop:0 white, stop: 0.4 gray, stop:1 green)
>>  }
>>
>> When I put this in an scss file and run it through sass, I get an
>> "Invalid CSS after ..." error.
>>
>> Is there any way to extend sass to allow this to pass through the
>> system?
>>
>> I really want to see if there is a way to bring the power of sass to
>> Qt.  My stylesheets now are a complete mess with magic color variables
>> and redundancies all over the place.  After seeing the power of sass/
>> compass on my web apps it is driving me crazy trying to do things the
>> old way. :)
>>
>>
>> Thanks,
>> Allen
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Haml" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected] <haml%[email protected]>.
>> For more options, visit this group at
>> http://groups.google.com/group/haml?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Haml" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected] <haml%[email protected]>.
> For more options, visit this group at
> http://groups.google.com/group/haml?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Reply via email to