From 2f6a98730f6af18a71b31c72468042f3b5b81915 Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Wed, 18 Apr 2012 13:45:43 +0100 Subject: Add edge colours --- tikzit/src/common/Preambles.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tikzit/src/common/Preambles.m') diff --git a/tikzit/src/common/Preambles.m b/tikzit/src/common/Preambles.m index d41f9b0..e107d5e 100644 --- a/tikzit/src/common/Preambles.m +++ b/tikzit/src/common/Preambles.m @@ -23,6 +23,7 @@ #import "Preambles.h" #import "NodeStyle.h" +#import "EdgeStyle.h" static NSString *PREAMBLE_HEAD = @"\\documentclass{article}\n" @@ -112,15 +113,21 @@ static NSString *POSTAMBLE = [fill hexName], [fill redFloat], [fill greenFloat], [fill blueFloat]]; } - if ([fill name] == nil && ![colors containsObject:fill]) { + if ([stroke name] == nil && ![colors containsObject:stroke]) { [colors addObject:stroke]; [colbuf appendFormat:@"\\definecolor{%@}{rgb}{%.3f,%.3f,%.3f}\n", - [fill hexName], [fill redFloat], [fill greenFloat], [fill blueFloat]]; + [stroke hexName], [stroke redFloat], [stroke greenFloat], [stroke blueFloat]]; } } [buf appendString:@"\n"]; for (EdgeStyle *st in [styleManager edgeStyles]) { [buf appendFormat:@"%@\n", [st tikz]]; + ColorRGB *color = [st colorRGB]; + if ([color name] == nil && ![colors containsObject:color]) { + [colors addObject:color]; + [colbuf appendFormat:@"\\definecolor{%@}{rgb}{%.3f,%.3f,%.3f}\n", + [color hexName], [color redFloat], [color greenFloat], [color blueFloat]]; + } } NSString *defs = [[NSString alloc] initWithFormat:@"%@\n%@", colbuf, buf]; -- cgit v1.2.3