Skip to content
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

Single-Stop Gradients Are Off-Color #132

Closed
Lonswaya opened this issue Nov 23, 2020 · 0 comments · Fixed by #144
Closed

Single-Stop Gradients Are Off-Color #132

Lonswaya opened this issue Nov 23, 2020 · 0 comments · Fixed by #144
Assignees
Labels
🍄 bug Something isn't working
Milestone

Comments

@Lonswaya
Copy link

ISSUE

I noticed this issue when programatically filling up views using a list of colors. When you only have a single color, single-stop gradient view, the color will be a darker, off-color hue with the same saturation.

I'd at least like to notify any other developers working on using this tool programatically, since discovering this issue found myself double and triple checking some of my color conversion logic.

CODE

With a MainPage looking like this in a brand-new Xamarin project, the differences can easily be spotted.

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:magicGradients="clr-namespace:MagicGradients;assembly=MagicGradients"
             x:Class="MagicGradientColorIssue.MainPage">
    <AbsoluteLayout
        BackgroundColor="#00AAE3">
        <magicGradients:GradientView
            AbsoluteLayout.LayoutBounds="0.5,0.0,0.5,0.5"
            AbsoluteLayout.LayoutFlags="All">
        <magicGradients:GradientView.GradientSource>
                <magicGradients:LinearGradient Angle="270">
                    <magicGradients:GradientStop Color="#00AAE3" Offset="0"/>
                </magicGradients:LinearGradient>
            </magicGradients:GradientView.GradientSource>
        </magicGradients:GradientView>
        <magicGradients:GradientView
            AbsoluteLayout.LayoutBounds="0.5,1,0.5,0.5"
            AbsoluteLayout.LayoutFlags="All">
            <magicGradients:GradientView.GradientSource>
                <magicGradients:LinearGradient Angle="270">
                    <magicGradients:GradientStop Color="#00AAE3" Offset="0"/>
                    <magicGradients:GradientStop Color="#FFFF00" Offset="1"/>
                </magicGradients:LinearGradient>
            </magicGradients:GradientView.GradientSource>
        </magicGradients:GradientView>
    </AbsoluteLayout>
</ContentPage>

Attempting to set our first gradient to a color of #00AAE3, the same as the background, results in a color of #0067C4. Once we add another color (#FFFF00), the color is corrected.

image

WORKAROUND

A simple workaround would be to set two gradient stops of the same color.

@mgierlasinski mgierlasinski added the 🍄 bug Something isn't working label Nov 25, 2020
@mgierlasinski mgierlasinski added this to the vNext milestone Nov 25, 2020
@mgierlasinski mgierlasinski self-assigned this Dec 18, 2020
@mgierlasinski mgierlasinski modified the milestones: vNext, v1.2.1 Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍄 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants