src/colors.cpp

changeset 178
a23024fc98e0
parent 139
72098474d362
child 205
1a4342d80de7
--- a/src/colors.cpp	Wed Mar 09 14:22:22 2022 +0200
+++ b/src/colors.cpp	Sun Mar 13 14:51:39 2022 +0200
@@ -178,6 +178,19 @@
 	}
 }
 
+QColor ldraw::colorEdge(ldraw::Color color, const ldraw::ColorTable& colorTable)
+{
+	if (isDirectColor(color))
+	{
+		QColor const faceColor = directColorFace(color);
+		return (luma(faceColor) < 0.4) ? Qt::white : Qt::black;
+	}
+	else
+	{
+		return colorTable[color].faceColor;
+	}
+}
+
 /**
  * @brief Writes a color index into a @c QDataStream
  * @param stream
@@ -199,3 +212,15 @@
 {
 	return stream >> color.index;
 }
+
+QString ldraw::colorDisplayName(ldraw::Color color, const ldraw::ColorTable &colorTable)
+{
+	if (isDirectColor(color))
+	{
+		return directColorFace(color).name();
+	}
+	else
+	{
+		return colorTable[color].displayName;
+	}
+}

mercurial