Fixed default color in checkerboard extension

This commit is contained in:
leyghisbb 2020-08-30 11:24:48 +02:00
parent bd584e6b13
commit 6202a68d26
2 changed files with 35 additions and 47 deletions

View File

@ -10,27 +10,17 @@
<param name="layer" type="bool" gui-text="Create in current layer">true</param>
</page>
<page name="color1" gui-text="1st color">
<param name="color1" type="color" gui-text="Color 1">#000000ff</param>
<param name="color1" type="color" gui-text="Color 1">4286282751</param>
</page>
<page name="color2" gui-text="2nd color">
<param name="color2" type="color" gui-text="Color 2">#ffffffff</param>
<param name="color2" type="color" gui-text="Color 2">8092671</param>
</page>
<page name="help" gui-text="Help">
<param name="help_text" type="description">Create a checkerboard
1. On the Params tab, choose the cell size
(size of the constituent squares), number
of rows and columns, and whether to add
the checkerboard to the current layer
(if unchecked, the checkerboard will be
added to the root layer)
2. On the 1st color and 2nd color tabs,
select the colors for the two sets of
squares
3. Click Apply
More information and source code:
https://github.com/jeffkayser/inkscape-checkerboard</param>
<label>1. On the Params tab, choose the cell size (size of the constituent squares), number of rows and columns, and whether to add the checkerboard to the current layer (if unchecked, the checkerboard will be added to the root layer)</label>
<label>2. On the 1st color and 2nd color tabs, select the colors for the two sets of squares</label>
<label>3. Click Apply</label>
<label>More information and source code:</label>
<label appearance="url">https://github.com/jeffkayser/inkscape-checkerboard</label>
</page>
</param>
<effect>

View File

@ -21,7 +21,6 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
from gettext import gettext as _
import inkex
from lxml import etree
import re
@ -66,8 +65,8 @@ class Checkerboard(inkex.Effect):
def __init__(self):
inkex.Effect.__init__(self)
self.arg_parser.add_argument("--tab")
self.arg_parser.add_argument("--color1", type=Color)
self.arg_parser.add_argument("--color2", type=Color)
self.arg_parser.add_argument("--color1", type=Color, default=4286282751)
self.arg_parser.add_argument("--color2", type=Color, default=8092671)
self.arg_parser.add_argument("--size")
self.arg_parser.add_argument("--rows", type=int)
self.arg_parser.add_argument("--cols", type=int)
@ -90,5 +89,4 @@ class Checkerboard(inkex.Effect):
x, y = self.svg.namedview.center[0] - cols * size / 2, self.svg.namedview.center[1] - rows * size / 2
draw_grid(x, y, rows, cols, size, color1, color2, group)
if __name__ == '__main__':
Checkerboard().run()
Checkerboard().run()