@@ -218,20 +218,20 @@ def __pow__(self, other: ColorSystem|int|float|tuple) -> ColorSystem:
218218 return result
219219 return type (self )(* result )
220220
221- def __iadd__ ( self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
222- return self . __add__ ( other )
223- def __isub__ ( self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
224- return self . __sub__ ( other )
225- def __imul__ ( self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
226- return self . __mul__ ( other )
227- def __ifloordiv__ ( self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
228- return self . __floordiv__ ( other )
229- def __itruediv__ ( self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
230- return self . __truediv__ ( other )
231- def __imod__ ( self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
232- return self . __mod__ ( other )
233- def __ipow__ ( self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
234- return self . __pow__ ( other )
221+ @ abstractmethod
222+ def __iadd__ ( self , other : ColorSystem | int | float | tuple ) -> ColorSystem :...
223+ @ abstractmethod
224+ def __isub__ ( self , other : ColorSystem | int | float | tuple ) -> ColorSystem :...
225+ @ abstractmethod
226+ def __imul__ ( self , other : ColorSystem | int | float | tuple ) -> ColorSystem :...
227+ @ abstractmethod
228+ def __ifloordiv__ ( self , other : ColorSystem | int | float | tuple ) -> ColorSystem :...
229+ @ abstractmethod
230+ def __itruediv__ ( self , other : ColorSystem | int | float | tuple ) -> ColorSystem :...
231+ @ abstractmethod
232+ def __imod__ ( self , other : ColorSystem | int | float | tuple ) -> ColorSystem :...
233+ @ abstractmethod
234+ def __ipow__ ( self , other : ColorSystem | int | float | tuple ) -> ColorSystem :...
235235
236236 # ------------------------------------------------------------------------------------------------------------------
237237 # - Comparison Dunders -
@@ -341,6 +341,49 @@ def b(self, value: int|float):
341341 def __repr__ (self ) -> str :
342342 return f"RGB(r={ self .r } ,g={ self .g } ,b={ self .b } )"
343343
344+ def __iadd__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
345+ value = dunder_func (func = CSD .add , left = self , right = other )
346+ if value is NotImplemented :
347+ return value
348+ self .r , self .g , self .b = value
349+ return self
350+ def __isub__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
351+ value = dunder_func (func = CSD .sub , left = self , right = other )
352+ if value is NotImplemented :
353+ return value
354+ self .r , self .g , self .b = value
355+ return self
356+ def __imul__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
357+ value = dunder_func (func = CSD .mul , left = self , right = other )
358+ if value is NotImplemented :
359+ return value
360+ self .r , self .g , self .b = value
361+ return self
362+ def __ifloordiv__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
363+ value = dunder_func (func = CSD .floordiv , left = self , right = other )
364+ if value is NotImplemented :
365+ return value
366+ self .r , self .g , self .b = value
367+ return self
368+ def __itruediv__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
369+ value = dunder_func (func = CSD .truediv , left = self , right = other )
370+ if value is NotImplemented :
371+ return value
372+ self .r , self .g , self .b = value
373+ return self
374+ def __imod__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
375+ value = dunder_func (func = CSD .mod , left = self , right = other )
376+ if value is NotImplemented :
377+ return value
378+ self .r , self .g , self .b = value
379+ return self
380+ def __ipow__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
381+ value = dunder_func (func = CSD .power , left = self , right = other )
382+ if value is NotImplemented :
383+ return value
384+ self .r , self .g , self .b = value
385+ return self
386+
344387# ----------------------------------------------------------------------------------------------------------------------
345388# - HEX -
346389# ----------------------------------------------------------------------------------------------------------------------
@@ -453,14 +496,57 @@ def a(self, value: int|float):
453496 self ._a = RoundHalfUp (Constrain (StrictType (value , (int ,float )), 255 ))
454497 else :
455498 self ._a = round (Constrain (StrictType (value , (int ,float )), 255 ))
456-
457499 # ------------------------------------------------------------------------------------------------------------------
458500 # MAGIC Methods
459501 # ------------------------------------------------------------------------------------------------------------------
460502 # String magic methods
461503 def __repr__ (self ) -> str :
462504 return f"RGBA(r={ self .r } ,g={ self .g } ,b={ self .b } ,a={ self .a } )"
463505
506+ def __iadd__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
507+ value = dunder_func (func = CSD .add , left = self , right = other )
508+ if value is NotImplemented :
509+ return value
510+ self .r , self .g , self .b , self .a = value
511+ return self
512+ def __isub__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
513+ value = dunder_func (func = CSD .sub , left = self , right = other )
514+ if value is NotImplemented :
515+ return value
516+ self .r , self .g , self .b , self .a = value
517+ return self
518+ def __imul__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
519+ value = dunder_func (func = CSD .mul , left = self , right = other )
520+ if value is NotImplemented :
521+ return value
522+ self .r , self .g , self .b , self .a = value
523+ return self
524+ def __ifloordiv__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
525+ value = dunder_func (func = CSD .floordiv , left = self , right = other )
526+ if value is NotImplemented :
527+ return value
528+ self .r , self .g , self .b , self .a = value
529+ return self
530+ def __itruediv__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
531+ value = dunder_func (func = CSD .truediv , left = self , right = other )
532+ if value is NotImplemented :
533+ return value
534+ self .r , self .g , self .b , self .a = value
535+ return self
536+ def __imod__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
537+ value = dunder_func (func = CSD .mod , left = self , right = other )
538+ if value is NotImplemented :
539+ return value
540+ self .r , self .g , self .b , self .a = value
541+ return self
542+ def __ipow__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
543+ value = dunder_func (func = CSD .power , left = self , right = other )
544+ if value is NotImplemented :
545+ return value
546+ self .r , self .g , self .b , self .a = value
547+ return self
548+
549+
464550# ----------------------------------------------------------------------------------------------------------------------
465551# - Code -
466552# ----------------------------------------------------------------------------------------------------------------------
@@ -564,6 +650,50 @@ def v(self, value: int|float):
564650 def __repr__ (self ) -> str :
565651 return f"HSV(h={ self .h } ,s={ self .s } ,v={ self .v } )"
566652
653+ def __iadd__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
654+ value = dunder_func (func = CSD .add , left = self , right = other )
655+ if value is NotImplemented :
656+ return value
657+ self .h ,self .s ,self .v = value
658+ return self
659+ def __isub__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
660+ value = dunder_func (func = CSD .sub , left = self , right = other )
661+ if value is NotImplemented :
662+ return value
663+ self .h ,self .s ,self .v = value
664+ return self
665+ def __imul__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
666+ value = dunder_func (func = CSD .mul , left = self , right = other )
667+ if value is NotImplemented :
668+ return value
669+ self .h ,self .s ,self .v = value
670+ return self
671+ def __ifloordiv__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
672+ value = dunder_func (func = CSD .floordiv , left = self , right = other )
673+ if value is NotImplemented :
674+ return value
675+ self .h ,self .s ,self .v = value
676+ return self
677+ def __itruediv__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
678+ value = dunder_func (func = CSD .truediv , left = self , right = other )
679+ if value is NotImplemented :
680+ return value
681+ self .h ,self .s ,self .v = value
682+ return self
683+ def __imod__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
684+ value = dunder_func (func = CSD .mod , left = self , right = other )
685+ if value is NotImplemented :
686+ return value
687+ self .h ,self .s ,self .v = value
688+ return self
689+ def __ipow__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
690+ value = dunder_func (func = CSD .power , left = self , right = other )
691+ if value is NotImplemented :
692+ return value
693+ self .h ,self .s ,self .v = value
694+ return self
695+
696+
567697
568698# ------------------------------------------------------------------------------------------------------------------
569699# - HSL -
@@ -614,6 +744,49 @@ def l(self, value: int|float):
614744 def __repr__ (self ) -> str :
615745 return f"HSL(h={ self .h } ,s={ self .s } ,l={ self .l } )"
616746
747+ def __iadd__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
748+ value = dunder_func (func = CSD .add , left = self , right = other )
749+ if value is NotImplemented :
750+ return value
751+ self .h ,self .s ,self .l = value
752+ return self
753+ def __isub__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
754+ value = dunder_func (func = CSD .sub , left = self , right = other )
755+ if value is NotImplemented :
756+ return value
757+ self .h ,self .s ,self .l = value
758+ return self
759+ def __imul__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
760+ value = dunder_func (func = CSD .mul , left = self , right = other )
761+ if value is NotImplemented :
762+ return value
763+ self .h ,self .s ,self .l = value
764+ return self
765+ def __ifloordiv__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
766+ value = dunder_func (func = CSD .floordiv , left = self , right = other )
767+ if value is NotImplemented :
768+ return value
769+ self .h ,self .s ,self .l = value
770+ return self
771+ def __itruediv__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
772+ value = dunder_func (func = CSD .truediv , left = self , right = other )
773+ if value is NotImplemented :
774+ return value
775+ self .h ,self .s ,self .l = value
776+ return self
777+ def __imod__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
778+ value = dunder_func (func = CSD .mod , left = self , right = other )
779+ if value is NotImplemented :
780+ return value
781+ self .h ,self .s ,self .l = value
782+ return self
783+ def __ipow__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
784+ value = dunder_func (func = CSD .power , left = self , right = other )
785+ if value is NotImplemented :
786+ return value
787+ self .h ,self .s ,self .l = value
788+ return self
789+
617790
618791# ----------------------------------------------------------------------------------------------------------------------
619792# - CMYK -
@@ -668,4 +841,47 @@ def k(self, value: int|float):
668841 # ------------------------------------------------------------------------------------------------------------------
669842 # String magic methods
670843 def __repr__ (self ) -> str :
671- return f"CMYK(c={ self .c } ,m={ self .m } ,y={ self .y } ,k={ self .k } )"
844+ return f"CMYK(c={ self .c } ,m={ self .m } ,y={ self .y } ,k={ self .k } )"
845+
846+ def __iadd__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
847+ value = dunder_func (func = CSD .add , left = self , right = other )
848+ if value is NotImplemented :
849+ return value
850+ self .c ,self .m ,self .y ,self .k = value
851+ return self
852+ def __isub__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
853+ value = dunder_func (func = CSD .sub , left = self , right = other )
854+ if value is NotImplemented :
855+ return value
856+ self .c ,self .m ,self .y ,self .k = value
857+ return self
858+ def __imul__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
859+ value = dunder_func (func = CSD .mul , left = self , right = other )
860+ if value is NotImplemented :
861+ return value
862+ self .c ,self .m ,self .y ,self .k = value
863+ return self
864+ def __ifloordiv__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
865+ value = dunder_func (func = CSD .floordiv , left = self , right = other )
866+ if value is NotImplemented :
867+ return value
868+ self .c ,self .m ,self .y ,self .k = value
869+ return self
870+ def __itruediv__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
871+ value = dunder_func (func = CSD .truediv , left = self , right = other )
872+ if value is NotImplemented :
873+ return value
874+ self .c ,self .m ,self .y ,self .k = value
875+ return self
876+ def __imod__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
877+ value = dunder_func (func = CSD .mod , left = self , right = other )
878+ if value is NotImplemented :
879+ return value
880+ self .c ,self .m ,self .y ,self .k = value
881+ return self
882+ def __ipow__ (self , other : ColorSystem | int | float | tuple ) -> ColorSystem :
883+ value = dunder_func (func = CSD .power , left = self , right = other )
884+ if value is NotImplemented :
885+ return value
886+ self .c ,self .m ,self .y ,self .k = value
887+ return self
0 commit comments