def prepareDocument(): """creates the new document, sets up colors """ colorList = getColorsFromDocument() spotDict = getSpotColors() scribus.statusMessage("Preparing new document...") scribus.newDocument(scribus.PAPER_A4, (15,15, 20, 20), scribus.PORTRAIT, 1, scribus.UNIT_POINTS, scribus.PAGE_1, 0, 1) scribus.setUnit(scribus.UNIT_MILLIMETERS) #delete existing colors cols = scribus.getColorNames() for col in cols: scribus.deleteColor(col, "None") #create our new colors for color in colorList: cname=color[0] c = int(color[1]) m = int(color[2]) y = int(color[3]) k = int(color[4]) scribus.defineColorCMYK(cname, c, m, y, k ) if spotDict.has_key(cname): scribus.setSpotColor(cname, spotDict[cname]) #get the pageTitle form user and store it in PageTitle global pageTitle pageTitle=scribus.valueDialog("ColorChart by Sebastian Stetter", "Please enter document title", "Scribus COLOR CHART") drawHeaderFooter(pageTitle)
def main(argv): """Translate imported RGB colors to CMYK colors.""" ######################### # YOUR CODE GOES HERE # ######################### if scribus.haveDoc(): clrs = scribus.getColorNames() newname = "" for clr in clrs: if clr.find("From") == 0: cmyk = scribus.getColor(clr) c = cmyk[0] cd = c * 100 / 255 ca = "c" + str(cd) m = cmyk[1] md = m * 100 / 255 ma = "m" + str(md) y = cmyk[2] yd = y * 100 / 255 ya = "y" + str(yd) k = cmyk[3] kd = k * 100 / 255 ka = "k" + str(kd) newname = ca + ma + ya + ka scribus.defineColor(newname, c, m, y, k) scribus.replaceColor(clr, newname) scribus.deleteColor(clr, newname)
def main(): if not scribus.haveDoc(): return for color_name in scribus.getColorNames(): if not color_name.startswith(('FromSVG', 'FromPDF')): continue c, m, y, k = scribus.getColor(color_name) cmyk_name = color_name[0:8] cmyk_name += f"{c*100//255:02x}{m*100//255:02x}{y*100//255:02x}{k*100//255:02x}" scribus.defineColor(cmyk_name, c, m, y, k) scribus.deleteColor(color_name, cmyk_name)
def colors(): scribus.defineColorCMYKFloat("NAK-blau 100%", 68.0, 34.0, 0.0, 0.0) scribus.defineColorRGB("Tabelle-Hintergrund", 215, 225, 243) scribus.deleteColor("Blue") scribus.deleteColor("Cool Black") scribus.deleteColor("Cyan") scribus.deleteColor("Green") scribus.deleteColor("Magenta") scribus.deleteColor("Red") scribus.deleteColor("Registration") scribus.deleteColor("Rich Black") scribus.deleteColor("Warm Black") scribus.deleteColor("Yellow")