Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8317407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:35:30+00:00 2026-06-08T21:35:30+00:00

When given an arbitrary color value, how would I use the relative difference between

  • 0

When given an arbitrary color value, how would I use the relative difference between that value and gradient offset 0 (below) to adjust the remaining offsets’ colors so that they having the same relative relationship with the new color as they had with the original color?

<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<LinearGradientBrush.GradientStops>
    <GradientStop Color="#FFDB0000" Offset="0" />
    <GradientStop Color="#FFB74134" Offset="0.6" />
    <GradientStop Color="#FFBA5643" Offset="0.85" />
    <GradientStop Color="#93C11E00" Offset="1" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>

My challenge is figuring out the mathematical formula to use to do the relative adjustments. Once I have this logic, it should be relatively easy to implement it in the particular technology I’m using (C#/.Net/WPF).

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:35:32+00:00Added an answer on June 8, 2026 at 9:35 pm

    Solution:

    Using the Hue-Saturation-Luminance (HSL) model, I determined:

    • the relative hue difference between the template gradient’s base color and each template stop color.
    • the absolute saturation and luminosity values of each template stop color.

    To generate the new gradient stops, I took the user-specified color and shifted its hue by the appropriate hue offset calculated above, then set its saturation and luminosity values to the values determined above.

    http://en.wikipedia.org/wiki/HSL_and_HSV provides a RGB-HSL formula. http://blogs.msdn.com/b/cjacks/archive/2006/04/12/575476.aspx describes how to do the HSL-to-RGB conversion.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given a valid, arbitrary xmlNodePtr, I would like the string representation of that node,
Given some arbitrary SQL I would like to get the data types of the
Given four (x,y) pairs that represent the four corners of an arbitrary polygon (quadrilateral)
Given an arbitrary enumeration in C#, how do I select a random value? (I
Given a non-negative integer n and an arbitrary set of inequalities that are user-defined
How could I highlight a given color in C#. The user selects an arbitrary
The below shows that SplPriorityQueue gives highest priority to the largest priority value which,
Given an arbitrary sequence of points in space, how would you produce a smooth
I would like to determine where the zone is given an arbitrary number. zones
Given an arbitrary file descriptor, can I make it blocking if it is non-blocking?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.