@@ -636,6 +636,242 @@ module.exports = {
636
636
}
637
637
```
638
638
639
+ ### forceRGB
640
+
641
+ Eğer forceRGB ` true ` olarak tanımlanırsa ek değişkenler oluşturulmaz.
642
+
643
+ #### Öncesi
644
+
645
+ ``` javascript
646
+ // tailwind.config.js
647
+
648
+ const colorVariable = require (' @mertasan/tailwindcss-variables/colorVariable' )
649
+
650
+ module .exports = {
651
+ theme: {
652
+ screens: false ,
653
+ colors: {
654
+ green: colorVariable (' var(--colors-green)' ),
655
+ },
656
+ variables: {
657
+ DEFAULT : {
658
+ colors: {
659
+ green: ' #11ff00' ,
660
+ },
661
+ },
662
+ },
663
+ },
664
+ plugins: [
665
+ require (' @mertasan/tailwindcss-variables' ){
666
+ colorVariables: true ,
667
+ }
668
+ ]
669
+ }
670
+ ```
671
+
672
+ ** Output:**
673
+
674
+ ``` css
675
+ :root {
676
+ --colors-green : #11ff00 ;
677
+ --colors-green-rgb : 17 ,255 ,0
678
+ }
679
+
680
+ .text-green {
681
+ --tw-text-opacity : 1 ;
682
+ color : rgba (var (--colors-green-rgb ), var (--tw-text-opacity ))
683
+ }
684
+ ```
685
+
686
+ #### Sonrası
687
+
688
+ ``` javascript
689
+ // tailwind.config.js
690
+
691
+ const colorVariable = require (' @mertasan/tailwindcss-variables/colorVariable' )
692
+
693
+ module .exports = {
694
+ theme: {
695
+ screens: false ,
696
+ colors: {
697
+ green: colorVariable (' var(--colors-green)' , true ),
698
+ },
699
+ variables: {
700
+ DEFAULT : {
701
+ colors: {
702
+ green: ' #11ff00' ,
703
+ },
704
+ },
705
+ },
706
+ },
707
+ plugins: [
708
+ require (' @mertasan/tailwindcss-variables' ){
709
+ colorVariables: true ,
710
+ forceRGB: true ,
711
+ }
712
+ ]
713
+ }
714
+ ```
715
+
716
+ ** Output:**
717
+
718
+ ``` css
719
+ :root {
720
+ --colors-green : #11ff00 ;
721
+ }
722
+
723
+ .text-green {
724
+ --tw-text-opacity : 1 ;
725
+ color : rgba (var (--colors-green ), var (--tw-text-opacity ))
726
+ }
727
+ ```
728
+
729
+
730
+ ### colorVariable için extendColors
731
+
732
+ Değişkenler arasındaki renklerin her birisini ` colorVariable('var(--colors-red-500)') ` şeklinde kullanmak yerine,
733
+ renkleri ` extendColors ` kısmında tanımlayabilirsiniz.
734
+
735
+ ** Örnek:**
736
+
737
+ ``` javascript
738
+ // tailwind.config.js
739
+
740
+ module .exports = {
741
+ theme: {
742
+ screens: false ,
743
+ colors: {
744
+ white: ' #fff' ,
745
+ green: ' var(--colors-green)' ,
746
+ },
747
+ variables: {
748
+ DEFAULT : {
749
+ colors: {
750
+ blue: ' #0065ff' ,
751
+ red: ' #ff0000' ,
752
+ green: ' #11ff00' ,
753
+ },
754
+ },
755
+ },
756
+ },
757
+ plugins: [
758
+ require (' @mertasan/tailwindcss-variables' ){
759
+ colorVariables: true ,
760
+ extendColors: {
761
+ blue: ' var(--colors-blue)' ,
762
+ red: ' var(--colors-red)' ,
763
+ }
764
+ }
765
+ ]
766
+ }
767
+ ```
768
+
769
+ ** Output:**
770
+
771
+ ``` css
772
+ :root {
773
+ --colors-blue : #0065ff ;
774
+ --colors-red : #ff0000 ;
775
+ --colors-green : #11ff00 ;
776
+ --colors-blue-rgb : 0 ,101 ,255 ;
777
+ --colors-red-rgb : 255 ,0 ,0 ;
778
+ --colors-green-rgb : 17 ,255 ,0
779
+ }
780
+
781
+ .text-white {
782
+ --tw-text-opacity : 1 ;
783
+ color : rgba (255 , 255 , 255 , var (--tw-text-opacity ))
784
+ }
785
+
786
+ .text-green {
787
+ color : var (--colors-green )
788
+ }
789
+
790
+ .text-blue {
791
+ --tw-text-opacity : 1 ;
792
+ color : rgba (var (--colors-blue-rgb ), var (--tw-text-opacity ))
793
+ }
794
+
795
+ .text-red {
796
+ --tw-text-opacity : 1 ;
797
+ color : rgba (var (--colors-red-rgb ), var (--tw-text-opacity ))
798
+ }
799
+
800
+ .text-opacity-50 {
801
+ --tw-text-opacity : 0.5
802
+ }
803
+ ```
804
+
805
+
806
+ ** 2. Örnek - [ forceRGB] ( #forcergb ) ile birlikte kullanımı:**
807
+
808
+ ``` javascript
809
+ // tailwind.config.js
810
+
811
+ module .exports = {
812
+ theme: {
813
+ screens: false ,
814
+ colors: {
815
+ white: ' #fff' ,
816
+ green: ' var(--colors-green)' ,
817
+ },
818
+ variables: {
819
+ DEFAULT : {
820
+ colors: {
821
+ blue: ' #0065ff' ,
822
+ red: ' #ff0000' ,
823
+ green: ' #11ff00' ,
824
+ },
825
+ },
826
+ },
827
+ },
828
+ plugins: [
829
+ require (' @mertasan/tailwindcss-variables' ){
830
+ colorVariables: true ,
831
+ forceRGB: true ,
832
+ extendColors: {
833
+ blue: ' var(--colors-blue)' ,
834
+ red: ' var(--colors-red)' ,
835
+ }
836
+ }
837
+ ]
838
+ }
839
+ ```
840
+
841
+ ** Output:**
842
+
843
+ ``` css
844
+ :root {
845
+ --colors-blue : 0 ,101 ,255 ;
846
+ --colors-red : 255 ,0 ,0 ;
847
+ --colors-green : 17 ,255 ,0
848
+ }
849
+
850
+ .text-white {
851
+ --tw-text-opacity : 1 ;
852
+ color : rgba (255 , 255 , 255 , var (--tw-text-opacity ))
853
+ }
854
+
855
+ .text-green {
856
+ color : var (--colors-green )
857
+ }
858
+
859
+ .text-blue {
860
+ --tw-text-opacity : 1 ;
861
+ color : rgba (var (--colors-blue ), var (--tw-text-opacity ))
862
+ }
863
+
864
+ .text-red {
865
+ --tw-text-opacity : 1 ;
866
+ color : rgba (var (--colors-red ), var (--tw-text-opacity ))
867
+ }
868
+
869
+ .text-opacity-50 {
870
+ --tw-text-opacity : 0.5
871
+ }
872
+ ```
873
+
874
+
639
875
## Kendi eklentileriniz için API örneği
640
876
641
877
- [ Ayrıntılı açıklama] ( #gerçek-kullanım-örneği-detaylı )
0 commit comments