简体   繁体   English

CSS最佳实践 - 调色板

[英]CSS Best Practice - Color Palette

I'm new to web development and I've been working with stylesheets as needed. 我是网络开发的新手,我一直在根据需要使用样式表。 My question is, for one website, we have a specific set of colors to use for consistency. 我的问题是,对于一个网站,我们有一组特定的颜色用于一致性。 I don't know the hex values well enough to see them and know off hand it's red (or a flavor of it), green, blue, etc. 我不知道十六进制值是否足以看到它们并且知道它的红色(或它的味道),绿色,蓝色等。

Would it make sense to have a comment at the top that is a "color reference" for the given site? 在顶部评论是否是给定网站的“颜色参考”是否有意义?

Example: 例:

/*
 [Site Name] Color Standards
 Red:   Specific #hexvalue for shade of red being used.
 White: #FFF or #FFFFFF
 Black: #000 or #000000
 Yellow: Specific #hexvalue for shade of yellow being used.
 and so on...
*/

I have not seen that in any of stylesheet examples around the web or anywhere else. 我没有在网络上的任何样式表示例或其他任何地方看到过这种情况。 As one who does not work with stylesheets on an "as needed" basis, I think this would be a good standard. 作为一个根据“需要”不使用样式表的人,我认为这将是一个很好的标准。 (I will certainly use it going forward.) I would understand why someone who works with them constantly would find this useless and would not do it. (我肯定会继续使用它。)我会理解为什么经常与他们合作的人会发现这无用而且不会这样做。

Edit: In response to comments: I (poorly) chose to have black and white in there as part of the example, but what I was getting at is why isn't done as a standard. 编辑:回应评论:作为示例的一部分,我(很差)选择在那里有黑色和白色,但我得到的是为什么没有作为标准。 The design document may not always be available (but I agree that it should). 设计文件可能并不总是可用(但我同意它应该)。 I wrote this after I started doing web development (which is new to me) and I just thought that something like this would make sense so that anyone could come into the stylesheet know what colors to use to keep the colors on the site consistent. 我在开始进行网页开发之后写了这篇文章(这对我来说是新的),我只是觉得这样的事情会有意义,所以任何人都可以进入样式表,知道用什么颜色来保持网站上的颜色一致。 If something like this were done, there would be no need to rely on an additonal resource: the original designer (who might have moved on), design document (which may or may not be available), or anybody else in the office/on the team. 如果这样的事情已经完成,就没有必要依赖额外的资源:原始设计师(可能已经移动),设计文档(可能有也可能不可用),或办公室/其他任何人团队。

我认为这是一个好主意,并且很少见,你应该看一看。

There's no standard for this or yes and no answer, so if you find it helps to keep hex references at the top of your style sheet in a comment, go for it. 这个或是和没有答案没有标准,所以如果你发现在评论中将十六进制引用保留在样式表的顶部是有帮助的,那就去吧。 You're not going to get punished for it. 你不会因此而受到惩罚。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM