Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

new method to deal with integer html colors

  • Loading branch information...
commit 9938805687bfaa718206a1ffe0b00b28fc242672 1 parent be635dd
tomcool420 authored
Showing with 16 additions and 3 deletions.
  1. +8 −1 SMFThemeInfo.h
  2. +8 −2 SMFThemeInfo.m
9 SMFThemeInfo.h
View
@@ -5,7 +5,7 @@
// Created by Thomas Cool on 10/30/10.
// Copyright 2010 tomcool.org. All rights reserved.
//
-#import <Backrow/Backrow.h>
+#import <Backrow/BackRow.h>
#import "SynthesizeSingleton.h"
/**
*Convenience Methods with images, colors, logos, sounds and more
@@ -162,6 +162,13 @@
*/
-(CGColorRef)colorWithRed:(float)r withGreen:(float)g withBlue:(float)b withAlpha:(float)a;
+/**
+ *Creates a color from the html color format
+ *
+ *@param n a positive integer representing the color
+ *@return autoreleased CGColorRef
+ */
+-(CGColorRef)colorFromHTMLColor:(int)n;
///-----
/// @name Attributes
///-----
10 SMFThemeInfo.m
View
@@ -7,7 +7,9 @@
//
#import "SMFThemeInfo.h"
-
+//#import "BRImage.h"
+//#import "BackRow.h"
+//#import "BRMediaMenuController.h"
//static float red[]= {0.0,0.0,0.6,0.0,0.33,0.0,0.66,1.0,1.0,0.5,1.0,1.0,1.0};
//static float green[]={0.0,0.0,0.4,1.0,0.33,1.0,0.66,0.0,0.5,0.0,0.0,1.0,1.0};
//static float blue[] ={0.0,1.0,0.2,1.0,0.33,0.0,0.66,1.0,0.0,0.5,0.0,1.0,0.0};
@@ -17,6 +19,7 @@ @implementation SMFThemeInfo
+ (SMFThemeInfo *)sharedTheme
{
+
@synchronized(self)
{
if (sharedTheme == nil)
@@ -24,7 +27,6 @@ + (SMFThemeInfo *)sharedTheme
sharedTheme = [[self alloc] init];
}
}
-
return sharedTheme;
}
@@ -99,6 +101,10 @@ -(CGColorRef)colorWithRed:(float)r withGreen:(float)g withBlue:(float)b withAlph
[(id)color autorelease];
return color;
}
+-(CGColorRef)colorFromHTMLColor:(int)c
+{
+ return [self colorWithRed:((c>>16)&0xFF)/255.0 withGreen:((c>>8)&0xFF)/255.0 withBlue:(c & 0xFF)/255.0 withAlpha:1.0];
+}
static float red[]= {0.0,0.0,0.6,0.0,0.33,0.0,0.66,1.0,1.0,0.5,1.0,1.0,1.0};
static float green[]={0.0,0.0,0.4,1.0,0.33,1.0,0.66,0.0,0.5,0.0,0.0,1.0,1.0};
static float blue[] ={0.0,1.0,0.2,1.0,0.33,0.0,0.66,1.0,0.0,0.5,0.0,1.0,0.0};
Please sign in to comment.
Something went wrong with that request. Please try again.