Skip to content

more strong convert function #2379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
littledu opened this issue Jan 10, 2015 · 4 comments
Closed

more strong convert function #2379

littledu opened this issue Jan 10, 2015 · 4 comments

Comments

@littledu
Copy link

I want to solve the rgba for old ie, the code maybe:

background-color:rgba(207,10,60,0.5);
filter:progid:DXImageTransform.Microsoft.gradient(enabled='true',startColorstr='#7FCF0A3C', endColorstr='#7FCF0A3C');

startColorstr=#7F... , 7F is from opacity(0.5). In less, no function convert. Can you supply more strong function in less?

Maybe the function called like:

LESS:

opacity-no-text(#cf0a3c,.5);

CSS

background-color:rgba(207,10,60,0.5);
filter:progid:DXImageTransform.Microsoft.gradient(enabled='true',startColorstr='#7FCF0A3C', endColorstr='#7FCF0A3C');

just a example. that is all.

i'm so sorry, my english is so poor, thanks!

@matthew-dean
Copy link
Member

You can do this already:

.test {
    @color: rgba(207,10,60,0.5);
    @msColor: argb(@color);
    background-color: @color;
    filter: ~"progid:DXImageTransform.Microsoft.gradient(enabled='true',startColorstr='@{msColor}', endColorstr='@{msColor}')";
}

--output:

.test {
  background-color: rgba(207, 10, 60, 0.5);
  filter: progid:DXImageTransform.Microsoft.gradient(enabled='true',startColorstr='#80cf0a3c', endColorstr='#80cf0a3c');
}

@seven-phases-max
Copy link
Member

Just in case all those quotes are not really necessary there, the following syntax should work just fine:

.test {
    @c: argb(rgba(207, 10, 60, 0.5));
    filter: progid:DXImageTransform.Microsoft.gradient(
        enabled=true, startColorstr=@c, endColorstr=@c
    );
}

@littledu
Copy link
Author

@ALL
Thanks for your answer. i know the argb function, but i think the alpha convert like

(0.5 * 255).toString(16) -> 7f

so, i was wrong.

@matthew-dean
Copy link
Member

@seven-phases-max Ah, I didn't realize escaping was no longer necessary for MS's filter:progid: format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants