Skip to content

Commit

Permalink
Updated to v1.0.4
Browse files Browse the repository at this point in the history
Fixed some light/dark mode issues on iOS 13-14
Refactored UI layout code
Updated project for modern theos installations
  • Loading branch information
CreatureSurvive committed Apr 24, 2021
1 parent 15fee72 commit e0f68cc
Show file tree
Hide file tree
Showing 16 changed files with 164 additions and 99 deletions.
2 changes: 2 additions & 0 deletions CSColorPicker Resources/CSColorPicker/UIColor+CSColorPicker.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// Copyright (c) 2016 - 2019 CreatureCoding. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIColor (CSColorPicker)

//
Expand Down
Binary file modified CSColorPicker Resources/libCSColorPicker.dylib
Binary file not shown.
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
ARCHS = armv7 armv7s arm64 arm64e
TARGET = iphone:clang:11.2:5.0
TARGET = iphone:clang:13.0:5.0

GO_EASY_ON_ME = 0
FINALPACKAGE = 1
DEBUG = 0

PREFIX = $(THEOS)/toolchains/xcode11.xctoolchain/usr/bin/
INSTALL_TARGET_PROCESSES = Preferences

include $(THEOS)/makefiles/common.mk

INCLUDES = $(THEOS_PROJECT_DIR)/source
Expand All @@ -15,7 +18,7 @@ $(LIBRARY_NAME)_FRAMEWORKS = UIKit CoreGraphics CoreFoundation
$(LIBRARY_NAME)_PRIVATE_FRAMEWORKS = Preferences
$(LIBRARY_NAME)_CFLAGS += -fobjc-arc -I$(INCLUDES) -IPrefix.pch

after-install::
install.exec "killall -9 Preferences"

include $(THEOS_MAKE_PATH)/library.mk

# SUBPROJECTS += lcpshim
# include $(THEOS_MAKE_PATH)/aggregate.mk
9 changes: 7 additions & 2 deletions control
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
Package: com.creaturesurvive.libcscolorpicker
Name: libCSColorPicker
Version: 1.0.1
Pre-Depends: firmware (>= 7.0)
Version: 1.0.4
Architecture: iphoneos-arm
Depiction: https://creaturecoding.com/?page=depiction&id=libcscolorpicker
Description: A minimal color picker library for developers
Maintainer: CreatureSurvive <support@creaturecoding.com>
Author: CreatureSurvive <support@creaturecoding.com>
Section: System
Homepage: https://creaturecoding.com/
Depiction: https://creaturecoding.com/?page=depiction&id=libcscolorpicker
SileoDepiction: https://creaturecoding.com/sileo/depiction/?package_id=libcscolorpicker
Tag: purpose::extension, compatible_min::iosiOS7

1 change: 1 addition & 0 deletions source/Categories/UIColor+CSColorPicker.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Created by CreatureSurvive on 3/17/17.
// Copyright (c) 2016 - 2019 CreatureCoding. All rights reserved.
//
#import <UIKit/UIKit.h>

@interface UIColor (CSColorPicker)

Expand Down
1 change: 1 addition & 0 deletions source/Cells/CSColorDisplayCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//

#import <Cells/CSColorDisplayCell.h>
#import <Prefix.h>

@implementation CSColorDisplayCell
@synthesize cellColorDisplay;
Expand Down
1 change: 1 addition & 0 deletions source/Cells/CSGradientDisplayCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//

#import <Cells/CSGradientDisplayCell.h>
#import <Prefix.h>

@implementation CSGradientDisplayCell
@synthesize cellColorDisplay, gradient;
Expand Down
2 changes: 2 additions & 0 deletions source/Controllers/CSColorPickerViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
@property (nonatomic, strong) CSColorPickerBackgroundView *colorPickerBackgroundView;
@property (nonatomic, strong) UIView *colorPickerPreviewView;
@property (nonatomic, strong) CSGradientSelection *gradientSelection;
@property (nonatomic, strong) UIVisualEffectView *topBackdrop;
@property (nonatomic, strong) UIVisualEffectView *bottomBackdrop;

@property (nonatomic, retain) CSColorSlider *colorPickerHueSlider;
@property (nonatomic, retain) CSColorSlider *colorPickerSaturationSlider;
Expand Down
186 changes: 110 additions & 76 deletions source/Controllers/CSColorPickerViewController.m

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions source/Controls/CSColorSlider.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//

#import <Controls/CSColorSlider.h>
#import <Prefix.h>

@interface CSColorSlider ()

Expand Down Expand Up @@ -60,7 +61,7 @@ - (void)baseInitWithType:(CSColorSliderType)sliderType label:(NSString *)label s
[self.sliderLabel setFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:16]];
[self.sliderLabel setText:label];
[self.sliderLabel setBackgroundColor:[UIColor clearColor]];
[self.sliderLabel setTextColor:[UIColor blackColor]];
[self.sliderLabel setTextColor:[UIColor respondsToSelector:@selector(labelColor)] ? [UIColor performSelector:@selector(labelColor)] : [UIColor blackColor]];
[self.sliderLabel setTextAlignment:NSTextAlignmentLeft];
[self insertSubview:self.sliderLabel atIndex:0];
[self.sliderLabel setTranslatesAutoresizingMaskIntoConstraints:NO];
Expand All @@ -73,20 +74,13 @@ - (void)baseInitWithType:(CSColorSliderType)sliderType label:(NSString *)label s
[self.sliderValueLabel setFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:16]];
[self.sliderValueLabel setText:@"0"];
[self.sliderValueLabel setBackgroundColor:[UIColor clearColor]];
[self.sliderValueLabel setTextColor:[UIColor blackColor]];
[self.sliderValueLabel setTextColor:[UIColor respondsToSelector:@selector(labelColor)] ? [UIColor performSelector:@selector(labelColor)] : [UIColor blackColor]];
[self.sliderValueLabel setTextAlignment:NSTextAlignmentRight];
[self insertSubview:self.sliderValueLabel atIndex:0];
[self.sliderValueLabel setTranslatesAutoresizingMaskIntoConstraints:NO];
[self addConstraint:[NSLayoutConstraint constraintWithItem:self.sliderValueLabel attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:0.5 constant:0]];
[self addConstraint:[NSLayoutConstraint constraintWithItem:self.sliderValueLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:0.98 constant:0]];

UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight];
UIVisualEffectView *cellBackgroundBlur = [[UIVisualEffectView alloc] initWithEffect:effect];
cellBackgroundBlur.frame = self.bounds;
cellBackgroundBlur.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
cellBackgroundBlur.userInteractionEnabled = NO;
[self insertSubview:cellBackgroundBlur atIndex:0];

self.sliderType = sliderType;
self.selectedColor = startColor;

Expand Down
2 changes: 2 additions & 0 deletions source/Headers/PSSpecifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// Copyright (c) 2016 - 2019 CreatureCoding. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface PSSpecifier : NSObject

@property (nonatomic, assign) id target;
Expand Down
2 changes: 2 additions & 0 deletions source/Headers/PSTableCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// Copyright (c) 2016 - 2019 CreatureCoding. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface PSTableCell : UITableViewCell

@property (nonatomic, retain) PSSpecifier *specifier;
Expand Down
2 changes: 2 additions & 0 deletions source/Headers/PSViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// Copyright (c) 2016 - 2019 CreatureCoding. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface PSViewController : UIViewController

@property (nonatomic, retain) PSSpecifier *specifier;
Expand Down
22 changes: 21 additions & 1 deletion Prefix.pch → source/Prefix.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,24 @@
#define CSInfo(format, ...)
#define CSError(format, ...)
#define CSWarn(format, ...)
#endif
#endif

NS_INLINE BOOL firmwareGreaterThanEqual(NSString *version) {
return [[[UIDevice currentDevice] systemVersion] floatValue] >= [version floatValue];
}

NS_INLINE BOOL firmwareGreaterThan(NSString *version) {
return [[[UIDevice currentDevice] systemVersion] floatValue] > [version floatValue];
}

NS_INLINE BOOL firmwareLessThanEqual(NSString *version) {
return [[[UIDevice currentDevice] systemVersion] floatValue] <= [version floatValue];
}

NS_INLINE BOOL firmwareLessThan(NSString *version) {
return [[[UIDevice currentDevice] systemVersion] floatValue] < [version floatValue];
}

NS_INLINE BOOL firmwareEqual(NSString *version) {
return [[[UIDevice currentDevice] systemVersion] floatValue] == [version floatValue];
}
2 changes: 2 additions & 0 deletions source/Views/CSGradientSelection.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// Copyright (c) 2016 - 2019 CreatureCoding. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface CSGradientSelection : UIView
@property(nonatomic, weak, readonly) id target;
@property(nonatomic, assign, readonly) SEL addAction;
Expand Down
8 changes: 1 addition & 7 deletions source/Views/CSGradientSelection.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ - (instancetype)initWithSize:(CGSize)size target:(id)target addAction:(SEL)add r
}

- (void)commonInit {
UIVisualEffectView *blurView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight]];
blurView.frame = self.bounds;
blurView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
blurView.userInteractionEnabled = NO;
[self addSubview:blurView];

_buttonPadding = 2.5;

_scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)];
Expand All @@ -48,7 +42,7 @@ - (void)commonInit {
_gradient.endPoint = CGPointMake(1, 0.5);
_gradient.hidden = YES;

[blurView.layer addSublayer:self.gradient];
[self.layer addSublayer:self.gradient];

[self addSubview:_scrollView];

Expand Down

0 comments on commit e0f68cc

Please sign in to comment.