diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 817c539d82..6d18980287 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -146,6 +146,9 @@ from draftutils.utils import filterObjectsForModifiers from draftutils.utils import is_closed_edge from draftutils.utils import isClosedEdge +from draftutils.utils import get_rgb +from draftutils.utils import getrgb + from draftutils.gui_utils import get3DView from draftutils.gui_utils import get_3d_view @@ -485,20 +488,6 @@ def getDXF(obj,direction=None): return result -def getrgb(color,testbw=True): - """getRGB(color,[testbw]): returns a rgb value #000000 from a freecad color - if testwb = True (default), pure white will be converted into pure black""" - r = str(hex(int(color[0]*255)))[2:].zfill(2) - g = str(hex(int(color[1]*255)))[2:].zfill(2) - b = str(hex(int(color[2]*255)))[2:].zfill(2) - col = "#"+r+g+b - if testbw: - if col == "#ffffff": - #print(getParam('SvgLinesBlack')) - if getParam('SvgLinesBlack',True): - col = "#000000" - return col - import getSVG as svg diff --git a/src/Mod/Draft/draftutils/utils.py b/src/Mod/Draft/draftutils/utils.py index bd3fca197d..0104cb5933 100644 --- a/src/Mod/Draft/draftutils/utils.py +++ b/src/Mod/Draft/draftutils/utils.py @@ -925,6 +925,31 @@ def svg_patterns(): svgpatterns = svg_patterns +def get_rgb(color, testbw=True): + """getRGB(color,[testbw]) + + Return a rgb value #000000 from a freecad color + + Parameters + ---------- + testwb : bool (default = True) + pure white will be converted into pure black + """ + r = str(hex(int(color[0]*255)))[2:].zfill(2) + g = str(hex(int(color[1]*255)))[2:].zfill(2) + b = str(hex(int(color[2]*255)))[2:].zfill(2) + col = "#"+r+g+b + if testbw: + if col == "#ffffff": + #print(getParam('SvgLinesBlack')) + if getParam('SvgLinesBlack',True): + col = "#000000" + return col + + +getrgb = get_rgb + + def get_movable_children(objectslist, recursive=True): """Return a list of objects with child objects that move with a host.