File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ class PrintOpPass : public impl::ViewOpGraphBase<PrintOpPass> {
124
124
private:
125
125
// / Generate a color mapping that will color every operation with the same
126
126
// / name the same way. It'll interpolate the hue in the HSV color-space,
127
- // / attempting to keep the contrast suitable for black text.
127
+ // / using muted colors that provide good contrast for black text.
128
128
template <typename T>
129
129
void initColorMapping (T &irEntity) {
130
130
backgroundColors.clear ();
@@ -137,8 +137,10 @@ class PrintOpPass : public impl::ViewOpGraphBase<PrintOpPass> {
137
137
});
138
138
for (auto indexedOps : llvm::enumerate (ops)) {
139
139
double hue = ((double )indexedOps.index ()) / ops.size ();
140
+ // Use lower saturation (0.3) and higher value (0.95) for better
141
+ // readability
140
142
backgroundColors[indexedOps.value ()->getName ()].second =
141
- std::to_string (hue) + " 1.0 1.0 " ;
143
+ std::to_string (hue) + " 0.3 0.95 " ;
142
144
}
143
145
}
144
146
@@ -263,7 +265,7 @@ class PrintOpPass : public impl::ViewOpGraphBase<PrintOpPass> {
263
265
attrs[" shape" ] = shape.str ();
264
266
if (!background.empty ()) {
265
267
attrs[" style" ] = " filled" ;
266
- attrs[" fillcolor" ] = ( " \" " + background + " \" " ) .str ();
268
+ attrs[" fillcolor" ] = quoteString ( background.str () );
267
269
}
268
270
os << llvm::format (" v%i " , nodeId);
269
271
emitAttrList (os, attrs);
You can’t perform that action at this time.
0 commit comments