TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: C# Color Space Converter

17 点作者 nobody271超过 6 年前

5 条评论

Taniwha超过 6 年前
In the past I used to build this stuff in silicon .... just a quick note it's quite common in the real world to get incoming values that are out of gamut (the results of compressing and decompressing data for example) - you need to pin your final values to 0-255 in the cases where they are < 0 or > 255 otherwise they tend to wrap, you also need to carry that extra bit of precision through your math (not such an issue with FP) to make sure you can detect this
评论 #18522847 未加载
nobody271超过 6 年前
This is mostly a port of the code on <a href="https:&#x2F;&#x2F;www.easyrgb.com&#x2F;en&#x2F;math.php" rel="nofollow">https:&#x2F;&#x2F;www.easyrgb.com&#x2F;en&#x2F;math.php</a> but I have added a few extras.<p>What I use it for is:<p>* RGB - easy to guess what values to use to make a color<p>* HSL - easy to change the hue of a color<p>* Lab - lets you compare colors<p>* Named color - lets you know the name of a color
评论 #18519620 未加载
Meph504超过 6 年前
The builtin System.Drawing.Color namespace already contains much of what you have in regards to colors to and from names.<p>There are a lot of helpful methods available.<p>Color foo = Color.FromArgb(int); int foo = Color.ToArgb(); Color foo = Color.FromName(&quot;CornflowerBlue&quot;);<p>Color itself also exposes .IsKnownColor and .IsNamedColor
评论 #18519670 未加载
Systemic33超过 6 年前
Lab has the cool effect that you can smoothly change the luminance of a particular color in steps (usually scale is 0-100), where each step has an equal perception of change to the user.<p>Very useful when making gradients.<p>I used this for my MSc thesis project :)
danbruc超过 6 年前
For more advanced needs there is Colourful .NET [1].<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;tompazourek&#x2F;Colourful" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tompazourek&#x2F;Colourful</a>
评论 #18519496 未加载